@npm_leadtech/legal-lib-components 7.63.8 → 7.63.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/src/components/atoms/FeatureItem/FeatureItem.d.ts +3 -0
  2. package/dist/src/components/atoms/FeatureItem/FeatureItem.js +5 -0
  3. package/dist/src/components/atoms/FeatureItem/FeatureItem.styled.d.ts +1 -0
  4. package/dist/src/components/atoms/FeatureItem/FeatureItem.styled.js +18 -0
  5. package/dist/src/components/atoms/FeatureItem/FeatureItem.styled.ts +19 -0
  6. package/dist/src/components/atoms/FeatureItem/FeatureItem.tsx +12 -0
  7. package/dist/src/components/atoms/FeatureItem/FeatureItemProps.d.ts +9 -0
  8. package/dist/src/components/atoms/FeatureItem/FeatureItemProps.js +1 -0
  9. package/dist/src/components/atoms/FeatureItem/FeatureItemProps.ts +10 -0
  10. package/dist/src/components/atoms/FeatureItem/index.d.ts +2 -0
  11. package/dist/src/components/atoms/FeatureItem/index.js +2 -0
  12. package/dist/src/components/atoms/FeatureItem/index.ts +2 -0
  13. package/dist/src/components/atoms/Logo/Logo.js +4 -2
  14. package/dist/src/components/atoms/Logo/Logo.tsx +4 -2
  15. package/dist/src/components/atoms/Logo/svg/legalfinity-logo.svg +15 -0
  16. package/dist/src/components/atoms/Logo/svg/legalfinity-white-logo.svg +15 -0
  17. package/dist/src/components/atoms/PlanCard/PlanCard.d.ts +3 -0
  18. package/dist/src/components/atoms/PlanCard/PlanCard.js +6 -0
  19. package/dist/src/components/atoms/PlanCard/PlanCard.styled.d.ts +8 -0
  20. package/dist/src/components/atoms/PlanCard/PlanCard.styled.js +75 -0
  21. package/dist/src/components/atoms/PlanCard/PlanCard.styled.ts +83 -0
  22. package/dist/src/components/atoms/PlanCard/PlanCard.tsx +42 -0
  23. package/dist/src/components/atoms/PlanCard/PlanCardProps.d.ts +23 -0
  24. package/dist/src/components/atoms/PlanCard/PlanCardProps.js +1 -0
  25. package/dist/src/components/atoms/PlanCard/PlanCardProps.ts +26 -0
  26. package/dist/src/components/atoms/PlanCard/index.d.ts +2 -0
  27. package/dist/src/components/atoms/PlanCard/index.js +2 -0
  28. package/dist/src/components/atoms/PlanCard/index.ts +2 -0
  29. package/dist/src/components/atoms/index.d.ts +2 -0
  30. package/dist/src/components/atoms/index.js +2 -0
  31. package/dist/src/components/atoms/index.ts +2 -0
  32. package/dist/src/components/molecules/AccordionItem/AccordionItem.styled.js +1 -6
  33. package/dist/src/components/molecules/AccordionItem/AccordionItem.styled.ts +1 -6
  34. package/dist/src/components/molecules/BoxForm/BoxForm.styled.js +8 -2
  35. package/dist/src/components/molecules/BoxForm/BoxForm.styled.ts +8 -2
  36. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.d.ts +3 -0
  37. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.js +5 -0
  38. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.styled.d.ts +3 -0
  39. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.styled.js +69 -0
  40. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.styled.ts +72 -0
  41. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.tsx +23 -0
  42. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBarProps.d.ts +6 -0
  43. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBarProps.js +1 -0
  44. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBarProps.ts +7 -0
  45. package/dist/src/components/molecules/StickyPlanBar/index.d.ts +2 -0
  46. package/dist/src/components/molecules/StickyPlanBar/index.js +2 -0
  47. package/dist/src/components/molecules/StickyPlanBar/index.ts +2 -0
  48. package/dist/src/components/molecules/index.d.ts +1 -0
  49. package/dist/src/components/molecules/index.js +1 -0
  50. package/dist/src/components/molecules/index.ts +1 -0
  51. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.d.ts +3 -0
  52. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.js +7 -0
  53. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.styled.d.ts +3 -0
  54. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.styled.js +35 -0
  55. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.styled.tsx +38 -0
  56. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.tsx +21 -0
  57. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeaderProps.d.ts +4 -0
  58. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeaderProps.js +1 -0
  59. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeaderProps.ts +4 -0
  60. package/dist/src/components/organisms/PricingPageHeader/index.d.ts +2 -0
  61. package/dist/src/components/organisms/PricingPageHeader/index.js +2 -0
  62. package/dist/src/components/organisms/PricingPageHeader/index.ts +2 -0
  63. package/dist/src/components/organisms/index.d.ts +1 -0
  64. package/dist/src/components/organisms/index.js +1 -0
  65. package/dist/src/components/organisms/index.ts +1 -0
  66. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.d.ts +3 -0
  67. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.js +58 -0
  68. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.styled.d.ts +16 -0
  69. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.styled.js +88 -0
  70. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.styled.ts +107 -0
  71. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.tsx +128 -0
  72. package/dist/src/components/pages/PricingPlansPage/PricingPlansPageProps.d.ts +9 -0
  73. package/dist/src/components/pages/PricingPlansPage/PricingPlansPageProps.js +1 -0
  74. package/dist/src/components/pages/PricingPlansPage/PricingPlansPageProps.ts +10 -0
  75. package/dist/src/components/pages/PricingPlansPage/index.d.ts +2 -0
  76. package/dist/src/components/pages/PricingPlansPage/index.js +2 -0
  77. package/dist/src/components/pages/PricingPlansPage/index.ts +2 -0
  78. package/dist/src/components/pages/index.d.ts +1 -0
  79. package/dist/src/components/pages/index.js +1 -0
  80. package/dist/src/components/pages/index.ts +1 -0
  81. package/dist/src/utils/throttle.d.ts +1 -0
  82. package/dist/src/utils/throttle.js +10 -0
  83. package/dist/src/utils/throttle.ts +11 -0
  84. package/dist/tsconfig.build.tsbuildinfo +1 -1
  85. 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'
@@ -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
+ }