@katajere/recap 1.0.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.
Files changed (149) hide show
  1. package/README.md +39 -0
  2. package/dist/App.css +120 -0
  3. package/dist/FloatingFrames.css +55 -0
  4. package/dist/FloatingFrames.d.ts +11 -0
  5. package/dist/FloatingFrames.d.ts.map +1 -0
  6. package/dist/FloatingFrames.js +12 -0
  7. package/dist/LoginScreen.css +146 -0
  8. package/dist/OtpScreen.css +133 -0
  9. package/dist/RecapApp.d.ts +17 -0
  10. package/dist/RecapApp.d.ts.map +1 -0
  11. package/dist/RecapApp.js +7 -0
  12. package/dist/RecapStory.css +105 -0
  13. package/dist/RecapStory.d.ts +11 -0
  14. package/dist/RecapStory.d.ts.map +1 -0
  15. package/dist/RecapStory.js +150 -0
  16. package/dist/StoryProgress.css +47 -0
  17. package/dist/StoryProgress.d.ts +15 -0
  18. package/dist/StoryProgress.d.ts.map +1 -0
  19. package/dist/StoryProgress.js +23 -0
  20. package/dist/assets/huxxle-blue-logo.png +0 -0
  21. package/dist/assets/huxxle-blue-logo.svg +14 -0
  22. package/dist/assets/huxxle-logo.png +0 -0
  23. package/dist/assets/huxxle_star_final.gif +0 -0
  24. package/dist/assets/login-logo.png +0 -0
  25. package/dist/assets/login-logo.svg +14 -0
  26. package/dist/assets/money-rain.png +0 -0
  27. package/dist/assets/raining-money.gif +0 -0
  28. package/dist/assets/recap-music.mp3 +0 -0
  29. package/dist/assets/sketch_draw.gif +0 -0
  30. package/dist/assets/slide-logo.png +0 -0
  31. package/dist/assets/slide-logo.svg +14 -0
  32. package/dist/assets/sound-off.svg +4 -0
  33. package/dist/assets/sound-on.svg +5 -0
  34. package/dist/components/Header.css +46 -0
  35. package/dist/components/Header.d.ts +12 -0
  36. package/dist/components/Header.d.ts.map +1 -0
  37. package/dist/components/Header.js +25 -0
  38. package/dist/data/mock.d.ts +8 -0
  39. package/dist/data/mock.d.ts.map +1 -0
  40. package/dist/data/mock.js +59 -0
  41. package/dist/data/recapCopy.d.ts +10 -0
  42. package/dist/data/recapCopy.d.ts.map +1 -0
  43. package/dist/data/recapCopy.js +23 -0
  44. package/dist/hooks/useBackgroundMusic.d.ts +20 -0
  45. package/dist/hooks/useBackgroundMusic.d.ts.map +1 -0
  46. package/dist/hooks/useBackgroundMusic.js +62 -0
  47. package/dist/index.css +13 -0
  48. package/dist/index.d.ts +30 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +40 -0
  51. package/dist/slides/Slide10Final.css +101 -0
  52. package/dist/slides/Slide10Final.d.ts +9 -0
  53. package/dist/slides/Slide10Final.d.ts.map +1 -0
  54. package/dist/slides/Slide10Final.js +68 -0
  55. package/dist/slides/Slide1Intro.css +261 -0
  56. package/dist/slides/Slide1Intro.d.ts +13 -0
  57. package/dist/slides/Slide1Intro.d.ts.map +1 -0
  58. package/dist/slides/Slide1Intro.js +61 -0
  59. package/dist/slides/Slide2Days.css +209 -0
  60. package/dist/slides/Slide2Days.d.ts +11 -0
  61. package/dist/slides/Slide2Days.d.ts.map +1 -0
  62. package/dist/slides/Slide2Days.js +11 -0
  63. package/dist/slides/Slide3Revenue.css +89 -0
  64. package/dist/slides/Slide3Revenue.d.ts +12 -0
  65. package/dist/slides/Slide3Revenue.d.ts.map +1 -0
  66. package/dist/slides/Slide3Revenue.js +16 -0
  67. package/dist/slides/Slide4Orders.css +135 -0
  68. package/dist/slides/Slide4Orders.d.ts +10 -0
  69. package/dist/slides/Slide4Orders.d.ts.map +1 -0
  70. package/dist/slides/Slide4Orders.js +16 -0
  71. package/dist/slides/Slide5Buyers.css +140 -0
  72. package/dist/slides/Slide5Buyers.d.ts +11 -0
  73. package/dist/slides/Slide5Buyers.d.ts.map +1 -0
  74. package/dist/slides/Slide5Buyers.js +12 -0
  75. package/dist/slides/Slide6Customer.css +92 -0
  76. package/dist/slides/Slide6Customer.d.ts +10 -0
  77. package/dist/slides/Slide6Customer.d.ts.map +1 -0
  78. package/dist/slides/Slide6Customer.js +10 -0
  79. package/dist/slides/Slide7Products.css +144 -0
  80. package/dist/slides/Slide7Products.d.ts +11 -0
  81. package/dist/slides/Slide7Products.d.ts.map +1 -0
  82. package/dist/slides/Slide7Products.js +29 -0
  83. package/dist/slides/Slide8Months.css +148 -0
  84. package/dist/slides/Slide8Months.d.ts +7 -0
  85. package/dist/slides/Slide8Months.d.ts.map +1 -0
  86. package/dist/slides/Slide8Months.js +31 -0
  87. package/dist/slides/Slide9Year.css +93 -0
  88. package/dist/slides/Slide9Year.d.ts +8 -0
  89. package/dist/slides/Slide9Year.d.ts.map +1 -0
  90. package/dist/slides/Slide9Year.js +9 -0
  91. package/dist/types.d.ts +33 -0
  92. package/dist/types.d.ts.map +1 -0
  93. package/dist/types.js +11 -0
  94. package/dist/utils/format.d.ts +9 -0
  95. package/dist/utils/format.d.ts.map +1 -0
  96. package/dist/utils/format.js +17 -0
  97. package/dist/utils/index.d.ts +3 -0
  98. package/dist/utils/index.d.ts.map +1 -0
  99. package/dist/utils/index.js +3 -0
  100. package/dist/utils/motion.d.ts +19 -0
  101. package/dist/utils/motion.d.ts.map +1 -0
  102. package/dist/utils/motion.js +80 -0
  103. package/package.json +98 -0
  104. package/src/App.css +120 -0
  105. package/src/App.tsx +73 -0
  106. package/src/FloatingFrames.css +55 -0
  107. package/src/FloatingFrames.tsx +27 -0
  108. package/src/LoginScreen.css +146 -0
  109. package/src/LoginScreen.tsx +70 -0
  110. package/src/OtpScreen.css +133 -0
  111. package/src/OtpScreen.tsx +109 -0
  112. package/src/RecapApp.tsx +34 -0
  113. package/src/RecapStory.css +105 -0
  114. package/src/RecapStory.tsx +269 -0
  115. package/src/StoryProgress.css +47 -0
  116. package/src/StoryProgress.tsx +60 -0
  117. package/src/assets.d.ts +41 -0
  118. package/src/components/Header.css +46 -0
  119. package/src/components/Header.tsx +41 -0
  120. package/src/data/mock.ts +62 -0
  121. package/src/data/recapCopy.ts +33 -0
  122. package/src/hooks/useBackgroundMusic.ts +79 -0
  123. package/src/index.css +13 -0
  124. package/src/index.ts +70 -0
  125. package/src/react-app-env.d.ts +26 -0
  126. package/src/slides/Slide10Final.css +101 -0
  127. package/src/slides/Slide10Final.tsx +105 -0
  128. package/src/slides/Slide1Intro.css +261 -0
  129. package/src/slides/Slide1Intro.tsx +141 -0
  130. package/src/slides/Slide2Days.css +209 -0
  131. package/src/slides/Slide2Days.tsx +92 -0
  132. package/src/slides/Slide3Revenue.css +89 -0
  133. package/src/slides/Slide3Revenue.tsx +76 -0
  134. package/src/slides/Slide4Orders.css +135 -0
  135. package/src/slides/Slide4Orders.tsx +63 -0
  136. package/src/slides/Slide5Buyers.css +140 -0
  137. package/src/slides/Slide5Buyers.tsx +74 -0
  138. package/src/slides/Slide6Customer.css +92 -0
  139. package/src/slides/Slide6Customer.tsx +27 -0
  140. package/src/slides/Slide7Products.css +144 -0
  141. package/src/slides/Slide7Products.tsx +81 -0
  142. package/src/slides/Slide8Months.css +148 -0
  143. package/src/slides/Slide8Months.tsx +63 -0
  144. package/src/slides/Slide9Year.css +93 -0
  145. package/src/slides/Slide9Year.tsx +35 -0
  146. package/src/types.ts +39 -0
  147. package/src/utils/format.ts +18 -0
  148. package/src/utils/index.ts +3 -0
  149. package/src/utils/motion.ts +89 -0
package/src/index.ts ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @huxxle/recap - Vendor Year in Review Experience
3
+ * Public API exports for NPM package
4
+ *
5
+ * This file exports components and types for use in:
6
+ * - WebApp: Direct RecapStory integration (no auth)
7
+ * - Backend: Server-side rendering for video generation
8
+ * - Standalone: Full App with authentication
9
+ */
10
+
11
+ // ============================================================================
12
+ // HEADLESS COMPONENTS (No authentication) - Use in WebApp & Backend
13
+ // ============================================================================
14
+
15
+ export { default as RecapApp } from './RecapApp';
16
+ export { default as RecapStory } from './RecapStory';
17
+ export { default as StoryProgress } from './StoryProgress';
18
+ export { default as FloatingFrames } from './FloatingFrames';
19
+ export { default as Header } from './components/Header';
20
+
21
+ // ============================================================================
22
+ // INDIVIDUAL SLIDES - For custom layouts or granular control
23
+ // ============================================================================
24
+
25
+ export { default as Slide1Intro } from './slides/Slide1Intro';
26
+ export { default as Slide2Days } from './slides/Slide2Days';
27
+ export { default as Slide3Revenue } from './slides/Slide3Revenue';
28
+ export { default as Slide4Orders } from './slides/Slide4Orders';
29
+ export { default as Slide5Buyers } from './slides/Slide5Buyers';
30
+ export { default as Slide6Customer } from './slides/Slide6Customer';
31
+ export { default as Slide7Products } from './slides/Slide7Products';
32
+ export { default as Slide8Months } from './slides/Slide8Months';
33
+ export { default as Slide9Year } from './slides/Slide9Year';
34
+ export { default as Slide10Final } from './slides/Slide10Final';
35
+
36
+ // ============================================================================
37
+ // TYPES - TypeScript support for consumers
38
+ // ============================================================================
39
+
40
+ export type {
41
+ RecapData,
42
+ ProductSummary,
43
+ BusinessCategory,
44
+ AuthStep,
45
+ } from './types';
46
+
47
+ export {
48
+ BUSINESS_CATEGORIES,
49
+ AUTH_STEPS,
50
+ } from './types';
51
+
52
+ // ============================================================================
53
+ // UTILITIES - Helper functions
54
+ // ============================================================================
55
+
56
+ export {
57
+ formatCurrency,
58
+ formatNumber,
59
+ } from './utils/format';
60
+
61
+ export {
62
+ slideDurations,
63
+ mockRecapData,
64
+ } from './data/mock';
65
+
66
+ // ============================================================================
67
+ // VERSION - For compatibility checking
68
+ // ============================================================================
69
+
70
+ export const VERSION = '1.0.0';
@@ -0,0 +1,26 @@
1
+ /// <reference types="react-scripts" />
2
+
3
+ declare module '*.png' {
4
+ const value: string;
5
+ export default value;
6
+ }
7
+
8
+ declare module '*.jpg' {
9
+ const value: string;
10
+ export default value;
11
+ }
12
+
13
+ declare module '*.jpeg' {
14
+ const value: string;
15
+ export default value;
16
+ }
17
+
18
+ declare module '*.svg' {
19
+ const value: string;
20
+ export default value;
21
+ }
22
+
23
+ declare module '*.gif' {
24
+ const value: string;
25
+ export default value;
26
+ }
@@ -0,0 +1,101 @@
1
+ .slide10-final {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ color: #FCFCFC;
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: center;
9
+ justify-content: center;
10
+ gap: 3.79%;
11
+ padding-top: 41.65vh;
12
+ margin-bottom: 2.84vh;
13
+ }
14
+
15
+ @media (max-height: 720px), (orientation: landscape) {
16
+ .slide10-final {
17
+ gap: clamp(16px, 2vh, 32px);
18
+ }
19
+
20
+ .slide10-final__button-group {
21
+ margin-top: clamp(32px, 5vh, 80px);
22
+ }
23
+ }
24
+
25
+ .slide10-final__badge {
26
+ box-sizing: border-box;
27
+ border: 0.5px solid #FCFCFC;
28
+ padding: 0.95% 4.1%;
29
+ font-family: 'Lora', serif;
30
+ font-size: clamp(10px, 3.08vw, 12px);
31
+ font-weight: 600;
32
+ letter-spacing: 0.08em;
33
+ }
34
+
35
+ .slide10-final__title {
36
+ font-family: 'Lora', serif;
37
+ font-size: clamp(24px, 10.26vw, 40px);
38
+ font-weight: 700;
39
+ line-height: 1.28;
40
+ text-transform: capitalize;
41
+ text-align: center;
42
+ width: 92.31%;
43
+ max-width: 360px;
44
+ background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
45
+ -webkit-background-clip: text;
46
+ -webkit-text-fill-color: transparent;
47
+ background-clip: text;
48
+ }
49
+
50
+ .slide10-final__button-group {
51
+ width: 91.79%;
52
+ max-width: 358px;
53
+ display: flex;
54
+ flex-direction: column;
55
+ gap: 8px;
56
+ margin-top: 14.16vh;
57
+ padding-bottom: 2.84vh;
58
+ margin-bottom: 2.84vh;
59
+ }
60
+
61
+ .slide10-final__button {
62
+ border: 1px solid #FCFCFC;
63
+ background: transparent;
64
+ color: #FCFCFC;
65
+ font-family: 'Lora', serif;
66
+ font-weight: 600;
67
+ font-size: clamp(12px, 4.1vw, 16px);
68
+ padding: 1.42% 4.1%;
69
+ min-height: 40px;
70
+ display: flex;
71
+ justify-content: center;
72
+ align-items: center;
73
+ cursor: pointer;
74
+ }
75
+
76
+ /* .slide10-final__button--replay {
77
+ width: 122px;
78
+ align-self: flex-start;
79
+ padding: 8px 16px;
80
+ font-size: 14px;
81
+ } */
82
+
83
+ .slide10-final__fallback {
84
+ margin-top: 1.42%;
85
+ font-size: clamp(12px, 3.59vw, 14px);
86
+ color: #FFCC80;
87
+ text-align: center;
88
+ max-width: 82.05%;
89
+ }
90
+
91
+ .slide10-final__manual-link {
92
+ margin-top: 0.95%;
93
+ border: 1px dashed #FFCC80;
94
+ background: transparent;
95
+ color: #FFCC80;
96
+ font-weight: 600;
97
+ padding: 1.19% 4.1%;
98
+ min-height: 36px;
99
+ cursor: pointer;
100
+ font-size: clamp(12px, 3.59vw, 14px);
101
+ }
@@ -0,0 +1,105 @@
1
+ import React from 'react';
2
+ import './Slide10Final.css';
3
+
4
+ interface Slide10FinalProps {
5
+ videoUrl: string;
6
+ downloadUrl: string;
7
+ onReplay: () => void;
8
+ }
9
+
10
+ function Slide10Final({ videoUrl, downloadUrl, onReplay }: Slide10FinalProps) {
11
+ const handleShare = async () => {
12
+ try {
13
+ // Fetch the media as a blob
14
+ const response = await fetch(videoUrl);
15
+ const blob = await response.blob();
16
+
17
+ // Determine the file type (video/image)
18
+ const fileExtension = videoUrl.split('.').pop()?.toLowerCase() || 'mp4';
19
+ const mimeType = fileExtension === 'mp4' ? 'video/mp4' : 'image/jpeg';
20
+ const fileName = `huxxle-wrapped-2025.${fileExtension}`;
21
+
22
+ // Create a File object (required for WhatsApp Status)
23
+ const file = new File([blob], fileName, {
24
+ type: mimeType
25
+ });
26
+
27
+ // Validate file size (WhatsApp limits: 5MB for images, 16MB for videos)
28
+ const maxSize = mimeType.startsWith('video') ? 16 * 1024 * 1024 : 5 * 1024 * 1024;
29
+ if (file.size > maxSize) {
30
+ alert(`File is too large. Maximum size is ${mimeType.startsWith('video') ? '16MB' : '5MB'}`);
31
+ return;
32
+ }
33
+
34
+ // Check if sharing files is supported
35
+ if (typeof navigator !== 'undefined' && navigator.canShare && navigator.canShare({ files: [file] })) {
36
+ await navigator.share({
37
+ files: [file],
38
+ title: 'My Huxxle Recap',
39
+ text: 'Check out my Wrapped 2025 highlights! 🎉'
40
+ });
41
+ return;
42
+ }
43
+
44
+ // Fallback to sharing URL if file sharing not supported
45
+ if (typeof navigator !== 'undefined' && navigator.share) {
46
+ await navigator.share({
47
+ title: 'My Huxxle Recap',
48
+ text: 'Check out my Wrapped 2025 highlights! 🎉',
49
+ url: videoUrl
50
+ });
51
+ return;
52
+ }
53
+
54
+ // Final fallback: open in new tab
55
+ if (typeof window !== 'undefined') {
56
+ window.open(videoUrl, '_blank', 'noopener');
57
+ }
58
+ } catch (error) {
59
+ console.error('Share canceled or failed', error);
60
+
61
+ // Fallback on error: open in new tab
62
+ if (typeof window !== 'undefined') {
63
+ window.open(videoUrl, '_blank', 'noopener');
64
+ }
65
+ }
66
+ };
67
+
68
+ const handleDownload = () => {
69
+ const anchor = document.createElement('a');
70
+ anchor.href = downloadUrl;
71
+ anchor.download = 'huxxle-wrapped-2025.mp4';
72
+ anchor.target = '_blank';
73
+ document.body.appendChild(anchor);
74
+ anchor.click();
75
+ document.body.removeChild(anchor);
76
+ };
77
+
78
+ const handleLearnMore = () => {
79
+ window.open('https://www.huxxle.com', '_blank', 'noopener');
80
+ };
81
+
82
+ return (
83
+ <div className="slide10-final">
84
+ <div className="slide10-final__badge">WRAPPED 2025</div>
85
+ <div className="slide10-final__title">Your#1 AI Business Assistant</div>
86
+
87
+ <div className="slide10-final__button-group">
88
+ <button className="slide10-final__button slide10-final__button--replay" onClick={onReplay}>
89
+ Replay
90
+ </button>
91
+ <button className="slide10-final__button" onClick={handleShare}>
92
+ Share Your Wrapped
93
+ </button>
94
+ <button className="slide10-final__button" onClick={handleDownload}>
95
+ Download Cards
96
+ </button>
97
+ <button className="slide10-final__button" onClick={handleLearnMore}>
98
+ Learn More on Huxxle
99
+ </button>
100
+ </div>
101
+ </div>
102
+ );
103
+ }
104
+
105
+ export default Slide10Final;
@@ -0,0 +1,261 @@
1
+ /* Slide1Intro.css - Responsive design */
2
+
3
+ .slide1-intro {
4
+ position: relative;
5
+ width: 100%;
6
+ height: 100%;
7
+ overflow: hidden;
8
+ display: flex;
9
+ flex-direction: column;
10
+ }
11
+
12
+ /* Brand name container - positioned at top */
13
+ .slide1-intro__brand-container {
14
+ display: flex;
15
+ flex-direction: column;
16
+ align-items: flex-start;
17
+ padding: 0;
18
+ gap: clamp(8px, 1.5%, 12px);
19
+ position: absolute;
20
+ top: clamp(32px, 5%, 48px);
21
+ left: clamp(12px, 4%, 16px);
22
+ z-index: 3;
23
+ overflow: visible;
24
+ width: calc(100% - clamp(24px, 8%, 32px));
25
+ }
26
+
27
+ /* Background "HEY" text - first line, with opacity */
28
+ .slide1-intro__bg-text {
29
+ font-family: 'Lora', serif;
30
+ font-style: normal;
31
+ font-weight: 700;
32
+ font-size: clamp(32px, 12vw, 56px);
33
+ line-height: 1;
34
+ background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
35
+ -webkit-background-clip: text;
36
+ -webkit-text-fill-color: transparent;
37
+ background-clip: text;
38
+ opacity: 0.1;
39
+ flex: none;
40
+ margin: 0;
41
+ white-space: nowrap;
42
+ }
43
+
44
+ /* Business name - animated horizontally */
45
+ .slide1-intro__brand {
46
+ font-family: 'Lora', serif;
47
+ font-style: normal;
48
+ font-weight: 700;
49
+ font-size: clamp(32px, 12vw, 56px);
50
+ line-height: 1;
51
+ background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
52
+ -webkit-background-clip: text;
53
+ -webkit-text-fill-color: transparent;
54
+ background-clip: text;
55
+ flex: none;
56
+ white-space: nowrap;
57
+ margin: 0;
58
+ }
59
+
60
+ /* Top floating frames - positioned at ~30% from top */
61
+ .slide1-intro__frames-top {
62
+ display: flex;
63
+ flex-direction: row;
64
+ justify-content: center;
65
+ align-items: center;
66
+ padding: 0;
67
+ gap: clamp(6px, 2%, 10px);
68
+ position: absolute;
69
+ width: 100%;
70
+ left: 0;
71
+ top: clamp(140px, 30%, 220px);
72
+ z-index: 2;
73
+ }
74
+
75
+ .slide1-intro__frames-top .frame-rect {
76
+ box-sizing: border-box;
77
+ width: clamp(120px, 35%, 160px);
78
+ aspect-ratio: 140 / 186;
79
+ border: 1px solid #FFFFFF;
80
+ flex: none;
81
+ }
82
+
83
+ /* Headline and subtitle container - positioned at ~63% from top */
84
+ .slide1-intro__text {
85
+ display: flex;
86
+ flex-direction: column;
87
+ align-items: flex-start;
88
+ gap: clamp(8px, 1.5%, 12px);
89
+ position: absolute;
90
+ width: calc(100% - clamp(24px, 8%, 32px));
91
+ left: clamp(12px, 4%, 16px);
92
+ top: clamp(320px, 63%, 480px);
93
+ z-index: 3;
94
+ }
95
+
96
+ .slide1-intro__headline {
97
+ width: 100%;
98
+ font-family: 'Lora', serif;
99
+ font-style: normal;
100
+ font-weight: 600;
101
+ font-size: clamp(20px, 6vw, 32px);
102
+ line-height: 1.2;
103
+ background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
104
+ -webkit-background-clip: text;
105
+ -webkit-text-fill-color: transparent;
106
+ background-clip: text;
107
+ flex: none;
108
+ margin: 0;
109
+ display: -webkit-box;
110
+ -webkit-line-clamp: 3;
111
+ line-clamp: inherit;
112
+ -webkit-box-orient: vertical;
113
+ overflow: hidden;
114
+ }
115
+
116
+ .slide1-intro__subtitle {
117
+ width: 100%;
118
+ font-family: 'Lora', serif;
119
+ font-style: normal;
120
+ font-weight: 400;
121
+ font-size: clamp(12px, 3.5vw, 14px);
122
+ line-height: 1.5;
123
+ color: #FFFFFF;
124
+ flex: none;
125
+ margin: 0;
126
+ }
127
+
128
+ /* Bottom floating frames - positioned at ~88% from top */
129
+ .slide1-intro__frames-bottom {
130
+ display: flex;
131
+ flex-direction: row;
132
+ justify-content: center;
133
+ align-items: center;
134
+ padding: 0;
135
+ gap: clamp(8px, 2%, 12px);
136
+ position: absolute;
137
+ width: 100%;
138
+ left: 0;
139
+ top: clamp(560px, 88%, 720px);
140
+ z-index: 2;
141
+ }
142
+
143
+ .slide1-intro__frames-bottom .frame-rect {
144
+ box-sizing: border-box;
145
+ width: clamp(120px, 35%, 160px);
146
+ aspect-ratio: 140 / 186;
147
+ border: 1px solid #FFFFFF;
148
+ flex: none;
149
+ }
150
+
151
+ @media (max-height: 600px) {
152
+ .slide1-intro__brand-container {
153
+ top: 16px;
154
+ }
155
+
156
+ .slide1-intro__bg-text,
157
+ .slide1-intro__brand {
158
+ font-size: clamp(24px, 10vw, 40px);
159
+ }
160
+
161
+ .slide1-intro__frames-top {
162
+ top: 30%;
163
+ }
164
+
165
+ .slide1-intro__text {
166
+ top: 60%;
167
+ }
168
+
169
+ .slide1-intro__headline {
170
+ font-size: clamp(16px, 5vw, 24px);
171
+ }
172
+
173
+ .slide1-intro__frames-bottom {
174
+ top: 85%;
175
+ }
176
+ }
177
+
178
+ .slide1-intro__frames-bottom .frame-rect {
179
+ box-sizing: border-box;
180
+ width: clamp(140px, 46.15vw, 180px);
181
+ height: clamp(186px, 28.44dvh, 240px);
182
+ border: 1px solid #FFFFFF;
183
+ flex: none;
184
+ }
185
+
186
+ /* Variant styles */
187
+ .slide1-intro--struggling {
188
+ background: linear-gradient(180deg, #1B1A3D 0%, #E33D2E 100%);
189
+ }
190
+
191
+ .slide1-intro--new-user {
192
+ background: linear-gradient(180deg, #FFFFFF 0%, #3F3DAD 100%);
193
+ }
194
+
195
+ .slide1-intro--struggling .slide1-intro__subtitle {
196
+ color: #F6E7DF;
197
+ }
198
+
199
+ .slide1-intro--new-user .slide1-intro__subtitle {
200
+ color: #16205A;
201
+ }
202
+
203
+ .slide1-intro--struggling .frame-rect {
204
+ border-color: rgba(255, 255, 255, 0.6);
205
+ }
206
+
207
+ .slide1-intro--new-user .slide1-intro__brand {
208
+ background: linear-gradient(180deg, #4F4CD8 0%, #2A2872 100%);
209
+ -webkit-background-clip: text;
210
+ -webkit-text-fill-color: transparent;
211
+ background-clip: text;
212
+ }
213
+
214
+ .slide1-intro--new-user .slide1-intro__headline {
215
+ background: none;
216
+ color: #E6E5F9;
217
+ -webkit-background-clip: unset;
218
+ background-clip: unset;
219
+ -webkit-text-fill-color: #E6E5F9;
220
+ }
221
+
222
+ .slide1-intro--new-user .slide1-intro__subtitle {
223
+ color: #CDCCF4;
224
+ }
225
+
226
+ .slide1-intro--new-user .frame-rect {
227
+ border-color: rgba(63, 61, 173, 0.6);
228
+ }
229
+
230
+ .slide1-intro--new-user .slide1-intro__bg-text {
231
+ background: linear-gradient(180deg, #4F4CD8 0%, #2A2872 100%);
232
+ -webkit-background-clip: text;
233
+ -webkit-text-fill-color: transparent;
234
+ background-clip: text;
235
+ opacity: 0.08;
236
+ }
237
+
238
+ /* Media queries for landscape and short screens */
239
+ @media (max-height: 720px), (orientation: landscape) {
240
+ /* .slide1-intro__brand-container {
241
+ top: clamp(32px, 4dvh, 40px);
242
+ gap: clamp(8px, 1.5dvh, 12px);
243
+ } */
244
+
245
+ .slide1-intro__bg-text,
246
+ .slide1-intro__brand {
247
+ font-size: clamp(32px, 12vw, 48px);
248
+ }
249
+
250
+ /* .slide1-intro__frames-top {
251
+ top: clamp(140px, 22dvh, 180px);
252
+ } */
253
+
254
+ /* .slide1-intro__text {
255
+ top: clamp(280px, 50dvh, 380px);
256
+ } */
257
+
258
+ /* .slide1-intro__frames-bottom {
259
+ top: clamp(420px, 70dvh, 520px);
260
+ } */
261
+ }
@@ -0,0 +1,141 @@
1
+ import React, { useLayoutEffect, useRef, useState } from 'react';
2
+ import { motion } from 'framer-motion';
3
+ import { delayedFadeIn } from '../utils';
4
+ import { BUSINESS_CATEGORIES, BusinessCategory } from '../types';
5
+ import { recapCopy } from '../data/recapCopy';
6
+ import './Slide1Intro.css';
7
+
8
+ interface Slide1IntroProps {
9
+ businessName: string;
10
+ businessCategory: BusinessCategory;
11
+ onDurationCalculated?: (duration: number) => void;
12
+ }
13
+
14
+ /**
15
+ * Slide1Intro - Identity slide with business name and category-based messaging
16
+ */
17
+ function Slide1Intro({ businessName, businessCategory, onDurationCalculated }: Slide1IntroProps) {
18
+ // Dynamic messaging based on category
19
+ const copy = recapCopy[businessCategory] ?? recapCopy[BUSINESS_CATEGORIES.THRIVING];
20
+ const headline = copy.introHeadline;
21
+ const [brandWidth, setBrandWidth] = useState(0);
22
+ const [headlineWidth, setHeadlineWidth] = useState(0);
23
+ const brandRef = useRef<HTMLDivElement | null>(null);
24
+ const headlineRef = useRef<HTMLHeadingElement | null>(null);
25
+
26
+ useLayoutEffect(() => {
27
+ if (brandRef.current) {
28
+ // Add extra buffer to account for hidden characters (approximately 3 character widths)
29
+ const extraBuffer = brandRef.current.scrollWidth * 0.25; // ~25% extra space
30
+ setBrandWidth(brandRef.current.scrollWidth + extraBuffer);
31
+ }
32
+ }, [businessName]);
33
+
34
+ useLayoutEffect(() => {
35
+ if (headlineRef.current) {
36
+ setHeadlineWidth(headlineRef.current.scrollWidth);
37
+ }
38
+ }, [headline]);
39
+
40
+ // Get actual viewport width for calculation
41
+ const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : 390;
42
+ const containerWidth = Math.min(viewportWidth, 430); // max-width from App.css
43
+ const sidePadding = Math.max(16, containerWidth * 0.041); // clamp(16px, 4.1vw, 20px)
44
+ const availableWidth = containerWidth - (sidePadding * 2);
45
+
46
+ const brandShift = Math.max(brandWidth - availableWidth, 0);
47
+ const headlineShift = Math.max(headlineWidth - availableWidth, 0);
48
+
49
+ // Calculate dynamic slide duration based on brand name length
50
+ // Tested with real data: 26-75 character business names
51
+ const baseAnimationDuration = 6; // seconds minimum for short names
52
+ const pixelsPerSecond = 65; // animation speed (constant across all names)
53
+
54
+ // Calculate animation duration for brand name
55
+ const brandAnimationDuration =
56
+ brandShift > 0
57
+ ? Math.max(baseAnimationDuration, brandShift / pixelsPerSecond)
58
+ : baseAnimationDuration;
59
+
60
+ // Calculate animation duration for headline
61
+ const headlineAnimationDuration = headlineShift > 0
62
+ ? Math.max(baseAnimationDuration, headlineShift / pixelsPerSecond)
63
+ : baseAnimationDuration;
64
+
65
+ // Use the longer of the two animations, plus buffer time
66
+ const dynamicSlideDuration = Math.max(
67
+ brandAnimationDuration,
68
+ headlineAnimationDuration
69
+ ) + 2; // +2 second buffer for user to read the final position
70
+
71
+ // Notify parent of calculated duration
72
+ React.useEffect(() => {
73
+ if (onDurationCalculated && brandWidth > 0 && headlineWidth > 0) {
74
+ onDurationCalculated(dynamicSlideDuration);
75
+ }
76
+ }, [dynamicSlideDuration, brandWidth, headlineWidth, onDurationCalculated]);
77
+
78
+ const slideClass = `slide1-intro slide1-intro--${copy.introVariant}`;
79
+
80
+ return (
81
+ <div className={slideClass}>
82
+ {/* Brand name container with HEY text and business name */}
83
+ <div className="slide1-intro__brand-container">
84
+ {/* Background "HEY" text */}
85
+ <div className="slide1-intro__bg-text">HEY</div>
86
+
87
+ {/* Business name (animated scroll left) */}
88
+ <motion.div
89
+ className="slide1-intro__brand"
90
+ ref={brandRef}
91
+ animate={{ x: [0, -brandShift] }}
92
+ transition={{ duration: brandAnimationDuration, repeat: 0, ease: 'linear' }}
93
+ >
94
+ {businessName}
95
+ </motion.div>
96
+ </div>
97
+
98
+ {/* Top floating frames (slow horizontal drift) */}
99
+ <motion.div
100
+ className="slide1-intro__frames-top"
101
+ animate={{ x: [-30, 30] }}
102
+ transition={{ duration: 15, repeat: Infinity, repeatType: 'reverse', ease: 'linear' }}
103
+ >
104
+ <div className="frame-rect" />
105
+ <div className="frame-rect" />
106
+ <div className="frame-rect" />
107
+ </motion.div>
108
+
109
+ {/* Headline and subtitle */}
110
+ <motion.div
111
+ className="slide1-intro__text"
112
+ variants={delayedFadeIn(0.5)}
113
+ initial="initial"
114
+ animate="animate"
115
+ >
116
+ <motion.h2
117
+ className="slide1-intro__headline"
118
+ ref={headlineRef}
119
+ animate={{ x: [0, -headlineShift] }}
120
+ transition={{ duration: headlineAnimationDuration, repeat: 1, repeatType: 'reverse', ease: 'linear' }}
121
+ >
122
+ {headline}
123
+ </motion.h2>
124
+ <p className="slide1-intro__subtitle">{copy.introSubtitle}</p>
125
+ </motion.div>
126
+
127
+ {/* Bottom floating frames (slow horizontal drift) */}
128
+ <motion.div
129
+ className="slide1-intro__frames-bottom"
130
+ animate={{ x: [-30, 30] }}
131
+ transition={{ duration: 15, repeat: Infinity, repeatType: 'reverse', ease: 'linear' }}
132
+ >
133
+ <div className="frame-rect" />
134
+ <div className="frame-rect" />
135
+ <div className="frame-rect" />
136
+ </motion.div>
137
+ </div>
138
+ );
139
+ }
140
+
141
+ export default Slide1Intro;