@katajere/recap 1.0.13 → 2.0.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.
- package/dist/App.css +32 -12
- package/dist/LoginScreen.css +22 -21
- package/dist/OtpScreen.css +20 -17
- package/dist/RecapStory.css +148 -0
- package/dist/RecapStory.d.ts +2 -2
- package/dist/RecapStory.d.ts.map +1 -1
- package/dist/RecapStory.js +169 -81
- package/dist/StoryProgress.css +3 -3
- package/dist/StoryProgress.d.ts +3 -2
- package/dist/StoryProgress.d.ts.map +1 -1
- package/dist/StoryProgress.js +66 -12
- package/dist/assets/huxxle-login-blue-logo.svg +14 -0
- package/dist/assets/noisy-background.png +0 -0
- package/dist/assets/noisy-background.svg +23 -0
- package/dist/assets/search-icon.svg +4 -0
- package/dist/assets/share-button.svg +5 -0
- package/dist/assets/web-icon.png +0 -0
- package/dist/assets/web-icon.svg +14 -0
- package/dist/components/Header.css +12 -1
- package/dist/components/Header.js +2 -2
- package/dist/data/mock.d.ts +1 -1
- package/dist/data/mock.d.ts.map +1 -1
- package/dist/data/mock.js +36 -23
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/slides/Slide10Final.css +73 -35
- package/dist/slides/Slide1Intro.css +204 -56
- package/dist/slides/Slide1Intro.d.ts +2 -1
- package/dist/slides/Slide1Intro.d.ts.map +1 -1
- package/dist/slides/Slide1Intro.js +41 -47
- package/dist/slides/Slide2Days.css +121 -34
- package/dist/slides/Slide2Days.d.ts +2 -1
- package/dist/slides/Slide2Days.d.ts.map +1 -1
- package/dist/slides/Slide2Days.js +45 -4
- package/dist/slides/Slide3Revenue.css +80 -38
- package/dist/slides/Slide3Revenue.d.ts.map +1 -1
- package/dist/slides/Slide3Revenue.js +31 -3
- package/dist/slides/Slide4Orders.css +93 -34
- package/dist/slides/Slide4Orders.d.ts +2 -1
- package/dist/slides/Slide4Orders.d.ts.map +1 -1
- package/dist/slides/Slide4Orders.js +45 -3
- package/dist/slides/Slide5Buyers.css +124 -67
- package/dist/slides/Slide5Buyers.d.ts +2 -1
- package/dist/slides/Slide5Buyers.d.ts.map +1 -1
- package/dist/slides/Slide5Buyers.js +43 -3
- package/dist/slides/Slide6Customer.css +294 -52
- package/dist/slides/Slide6Customer.d.ts +6 -3
- package/dist/slides/Slide6Customer.d.ts.map +1 -1
- package/dist/slides/Slide6Customer.js +25 -4
- package/dist/slides/Slide7Products.css +8 -7
- package/dist/slides/Slide7Products.js +3 -3
- package/dist/slides/Slide8Months.css +6 -6
- package/dist/slides/Slide9Year.css +4 -2
- package/dist/slides/Slide9Year.d.ts +2 -1
- package/dist/slides/Slide9Year.d.ts.map +1 -1
- package/dist/slides/Slide9Year.js +23 -2
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/slideScreenshot.d.ts +27 -0
- package/dist/utils/slideScreenshot.d.ts.map +1 -0
- package/dist/utils/slideScreenshot.js +274 -0
- package/package.json +2 -1
- package/src/App.css +32 -12
- package/src/LoginScreen.css +22 -21
- package/src/LoginScreen.tsx +1 -1
- package/src/OtpScreen.css +20 -17
- package/src/OtpScreen.tsx +1 -1
- package/src/RecapStory.css +148 -0
- package/src/RecapStory.tsx +249 -118
- package/src/StoryProgress.css +3 -3
- package/src/StoryProgress.tsx +96 -21
- package/src/components/Header.css +12 -1
- package/src/components/Header.tsx +2 -2
- package/src/data/mock.ts +44 -24
- package/src/index.ts +0 -1
- package/src/slides/Slide10Final.css +73 -35
- package/src/slides/Slide1Intro.css +204 -56
- package/src/slides/Slide1Intro.tsx +89 -81
- package/src/slides/Slide2Days.css +121 -34
- package/src/slides/Slide2Days.tsx +67 -19
- package/src/slides/Slide3Revenue.css +80 -38
- package/src/slides/Slide3Revenue.tsx +43 -6
- package/src/slides/Slide4Orders.css +93 -34
- package/src/slides/Slide4Orders.tsx +71 -10
- package/src/slides/Slide5Buyers.css +124 -67
- package/src/slides/Slide5Buyers.tsx +97 -38
- package/src/slides/Slide6Customer.css +294 -52
- package/src/slides/Slide6Customer.tsx +68 -10
- package/src/slides/Slide7Products.css +8 -7
- package/src/slides/Slide7Products.tsx +3 -3
- package/src/slides/Slide8Months.css +6 -6
- package/src/slides/Slide9Year.css +4 -2
- package/src/slides/Slide9Year.tsx +35 -7
- package/src/types.ts +7 -0
- package/src/utils/slideScreenshot.ts +324 -0
- package/dist/FloatingFrames.css +0 -55
- package/dist/FloatingFrames.d.ts +0 -11
- package/dist/FloatingFrames.d.ts.map +0 -1
- package/dist/FloatingFrames.js +0 -12
- package/src/FloatingFrames.css +0 -55
- package/src/FloatingFrames.tsx +0 -27
package/src/RecapStory.css
CHANGED
|
@@ -103,3 +103,151 @@
|
|
|
103
103
|
width: 100%;
|
|
104
104
|
height: 100%;
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
/* Base button style for floating buttons */
|
|
108
|
+
.recap-story__floating-btn {
|
|
109
|
+
position: absolute;
|
|
110
|
+
bottom: calc(32px + env(safe-area-inset-bottom));
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: row;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
align-items: center;
|
|
115
|
+
padding: 8px;
|
|
116
|
+
gap: 8px;
|
|
117
|
+
background: #FCFCFC url('./assets/noisy-background.png') repeat;
|
|
118
|
+
background-size: 390px 844px;
|
|
119
|
+
border: 1px solid var(--border-line);
|
|
120
|
+
box-shadow: 0px 4px 100px rgba(0, 0, 0, 0.24);
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
z-index: 10;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.recap-story__floating-btn:hover {
|
|
126
|
+
box-shadow: 0px 6px 120px rgba(0, 0, 0, 0.32);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.recap-story__floating-btn:active {
|
|
130
|
+
box-shadow: 0px 2px 80px rgba(0, 0, 0, 0.24);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Sound button - positioned left, always visible */
|
|
134
|
+
.recap-story__sound-btn {
|
|
135
|
+
left: calc(16px + env(safe-area-inset-left));
|
|
136
|
+
width: 36px;
|
|
137
|
+
height: 36px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.recap-story__sound-btn svg {
|
|
141
|
+
width: 20px;
|
|
142
|
+
height: 20px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Share button - positioned right, hidden initially */
|
|
146
|
+
.recap-story__share-btn {
|
|
147
|
+
right: calc(16px + env(safe-area-inset-right));
|
|
148
|
+
height: 36px;
|
|
149
|
+
padding: 8px 12px;
|
|
150
|
+
gap: 4px;
|
|
151
|
+
/* Hidden by default until counter animations complete */
|
|
152
|
+
opacity: 0;
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
/* Transition must be on base state for smooth animation */
|
|
155
|
+
transition: opacity 0.4s ease-out;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Show share button when ready */
|
|
159
|
+
.recap-story__share-btn--visible {
|
|
160
|
+
opacity: 1;
|
|
161
|
+
pointer-events: auto;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.recap-story__share-btn svg {
|
|
165
|
+
width: 20px;
|
|
166
|
+
height: 20px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.recap-story__share-text {
|
|
170
|
+
font-family: 'Lora', serif;
|
|
171
|
+
font-weight: 600;
|
|
172
|
+
font-size: 12px;
|
|
173
|
+
line-height: 120%;
|
|
174
|
+
color: #4F4CD8;
|
|
175
|
+
white-space: nowrap;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Screenshot mode - prepares the slide for clean capture */
|
|
179
|
+
/* Note: Buttons are excluded via html2canvas ignoreElements option, not CSS */
|
|
180
|
+
.recap-story.screenshot-mode .recap-story__progress-wrap {
|
|
181
|
+
display: none !important;
|
|
182
|
+
visibility: hidden !important;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Force elements to be visible (in case animations are mid-flight) */
|
|
186
|
+
.recap-story.screenshot-mode [style*="opacity"] {
|
|
187
|
+
opacity: 1 !important;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/*
|
|
191
|
+
* Fix gradient text for html2canvas - background-clip:text not supported.
|
|
192
|
+
* We remove the gradient background and use solid color fallback.
|
|
193
|
+
* This targets all known gradient text elements.
|
|
194
|
+
*/
|
|
195
|
+
.recap-story.screenshot-mode .header__badge,
|
|
196
|
+
.recap-story.screenshot-mode .slide1-intro__brand,
|
|
197
|
+
.recap-story.screenshot-mode .slide1-intro__bg-text,
|
|
198
|
+
.recap-story.screenshot-mode .stats-number,
|
|
199
|
+
.recap-story.screenshot-mode .stats-label,
|
|
200
|
+
.recap-story.screenshot-mode .stats-sublabel,
|
|
201
|
+
.recap-story.screenshot-mode .streak-number,
|
|
202
|
+
.recap-story.screenshot-mode .streak-label,
|
|
203
|
+
.recap-story.screenshot-mode .slide3-revenue__amount,
|
|
204
|
+
.recap-story.screenshot-mode .slide3-revenue__currency,
|
|
205
|
+
.recap-story.screenshot-mode .slide4-orders__number,
|
|
206
|
+
.recap-story.screenshot-mode .slide5-buyers__number,
|
|
207
|
+
.recap-story.screenshot-mode .slide5-buyers__label,
|
|
208
|
+
.recap-story.screenshot-mode .slide6-customer__number,
|
|
209
|
+
.recap-story.screenshot-mode .slide6-customer__label,
|
|
210
|
+
.recap-story.screenshot-mode .slide7-products__lead,
|
|
211
|
+
.recap-story.screenshot-mode .slide7-products__rank,
|
|
212
|
+
.recap-story.screenshot-mode .slide7-products__title,
|
|
213
|
+
.recap-story.screenshot-mode .slide7-products__subtitle,
|
|
214
|
+
.recap-story.screenshot-mode .slide8-months__message,
|
|
215
|
+
.recap-story.screenshot-mode .slide8-months__entry,
|
|
216
|
+
.recap-story.screenshot-mode .slide9-year__message,
|
|
217
|
+
.recap-story.screenshot-mode .slide9-year__title,
|
|
218
|
+
.recap-story.screenshot-mode .slide10-final__badge,
|
|
219
|
+
.recap-story.screenshot-mode .slide10-final__title {
|
|
220
|
+
background: none !important;
|
|
221
|
+
-webkit-background-clip: unset !important;
|
|
222
|
+
background-clip: unset !important;
|
|
223
|
+
-webkit-text-fill-color: #4F4CD8 !important;
|
|
224
|
+
color: #4F4CD8 !important;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* Fix outline text (stroke) for screenshot - keep stroke styling but fix fill color */
|
|
228
|
+
.recap-story.screenshot-mode .streak-number {
|
|
229
|
+
background: none !important;
|
|
230
|
+
-webkit-background-clip: unset !important;
|
|
231
|
+
background-clip: unset !important;
|
|
232
|
+
color: #FFFFFF !important;
|
|
233
|
+
-webkit-text-fill-color: #FFFFFF !important;
|
|
234
|
+
-webkit-text-stroke: 1.5px #4F4CD8 !important;
|
|
235
|
+
paint-order: stroke fill !important;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.recap-story.screenshot-mode .slide5-buyers__number--secondary,
|
|
239
|
+
.recap-story.screenshot-mode .slide6-customer__number--secondary {
|
|
240
|
+
background: none !important;
|
|
241
|
+
-webkit-background-clip: unset !important;
|
|
242
|
+
background-clip: unset !important;
|
|
243
|
+
color: #FFFFFF !important;
|
|
244
|
+
-webkit-text-fill-color: #FFFFFF !important;
|
|
245
|
+
-webkit-text-stroke: 1.5px #4F4CD8 !important;
|
|
246
|
+
paint-order: stroke fill !important;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* Fix overflow issues for grids/decorative elements that may be clipped */
|
|
250
|
+
.recap-story.screenshot-mode .slide4-orders__grid,
|
|
251
|
+
.recap-story.screenshot-mode .slide7-products__frames {
|
|
252
|
+
overflow: visible !important;
|
|
253
|
+
}
|
package/src/RecapStory.tsx
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { AnimatePresence, motion } from
|
|
3
|
-
import StoryProgress from
|
|
4
|
-
import Header from
|
|
5
|
-
import Slide1Intro from
|
|
6
|
-
import Slide2Days from
|
|
7
|
-
import Slide3Revenue from
|
|
8
|
-
import Slide4Orders from
|
|
9
|
-
import Slide5Buyers from
|
|
10
|
-
import Slide6Customer from
|
|
11
|
-
import Slide7Products from
|
|
12
|
-
import Slide8Months from
|
|
13
|
-
import Slide9Year from
|
|
14
|
-
import Slide10Final from
|
|
15
|
-
import { slideVariants } from
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import './RecapStory.css';
|
|
1
|
+
import React, { useState, useRef } from "react";
|
|
2
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
3
|
+
import StoryProgress from "./StoryProgress";
|
|
4
|
+
import Header from "./components/Header";
|
|
5
|
+
import Slide1Intro from "./slides/Slide1Intro";
|
|
6
|
+
import Slide2Days from "./slides/Slide2Days";
|
|
7
|
+
import Slide3Revenue from "./slides/Slide3Revenue";
|
|
8
|
+
import Slide4Orders from "./slides/Slide4Orders";
|
|
9
|
+
import Slide5Buyers from "./slides/Slide5Buyers";
|
|
10
|
+
import Slide6Customer from "./slides/Slide6Customer";
|
|
11
|
+
import Slide7Products from "./slides/Slide7Products";
|
|
12
|
+
import Slide8Months from "./slides/Slide8Months";
|
|
13
|
+
import Slide9Year from "./slides/Slide9Year";
|
|
14
|
+
import Slide10Final from "./slides/Slide10Final";
|
|
15
|
+
import { slideVariants } from "./utils";
|
|
16
|
+
import { captureAndShareSlide, preCaptureSlide, clearScreenshotCache } from "./utils/slideScreenshot";
|
|
17
|
+
import { slideDurations as defaultDurations } from "./data/mock";
|
|
18
|
+
import { BUSINESS_CATEGORIES, RecapData } from "./types";
|
|
19
|
+
import { useBackgroundMusic } from "./hooks/useBackgroundMusic";
|
|
20
|
+
import recapMusic from "./assets/recap-music.mp3";
|
|
21
|
+
import "./RecapStory.css";
|
|
23
22
|
|
|
24
23
|
interface RecapStoryProps {
|
|
25
24
|
recapData: RecapData;
|
|
@@ -30,47 +29,92 @@ interface RecapStoryProps {
|
|
|
30
29
|
*/
|
|
31
30
|
function RecapStory({ recapData }: RecapStoryProps) {
|
|
32
31
|
const [activeIndex, setActiveIndex] = useState<number>(0);
|
|
33
|
-
const
|
|
34
|
-
const [
|
|
32
|
+
const durations = recapData.slideDurations || defaultDurations;
|
|
33
|
+
const [isPaused, setIsPaused] = useState<boolean>(false);
|
|
34
|
+
const [isShareVisible, setIsShareVisible] = useState<boolean>(false);
|
|
35
|
+
const holdTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
36
|
+
const isHoldingRef = useRef<boolean>(false);
|
|
37
|
+
const slidesContainerRef = useRef<HTMLDivElement>(null);
|
|
38
|
+
|
|
39
|
+
// Cleanup on unmount to prevent memory leaks
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
return () => {
|
|
42
|
+
if (holdTimerRef.current) {
|
|
43
|
+
clearTimeout(holdTimerRef.current);
|
|
44
|
+
}
|
|
45
|
+
// Clear screenshot cache on unmount
|
|
46
|
+
clearScreenshotCache();
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
|
|
35
50
|
const { isMuted, isPlaying, toggleMute, play, stop } = useBackgroundMusic({
|
|
36
51
|
src: recapMusic,
|
|
37
52
|
volume: 0.6,
|
|
38
53
|
autoPlay: true,
|
|
39
|
-
loop: false
|
|
54
|
+
loop: false,
|
|
40
55
|
});
|
|
41
|
-
|
|
42
|
-
// Handle intro duration updates
|
|
43
|
-
const handleIntroDurationCalculated = (duration: number) => {
|
|
44
|
-
setIntroDuration(duration);
|
|
45
|
-
setIsIntroDurationReady(true);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// Reset ready state when returning to intro slide
|
|
49
|
-
React.useEffect(() => {
|
|
50
|
-
if (activeIndex === 0) {
|
|
51
|
-
setIsIntroDurationReady(false);
|
|
52
|
-
}
|
|
53
|
-
}, [activeIndex]);
|
|
54
56
|
|
|
55
57
|
const isNewUser = recapData.businessCategory === BUSINESS_CATEGORIES.NEW_USER;
|
|
56
58
|
|
|
57
59
|
// Define slides with their durations (new-user only sees the intro)
|
|
58
60
|
const fullSlideSet = [
|
|
59
|
-
{ id:
|
|
60
|
-
{ id:
|
|
61
|
-
{ id:
|
|
62
|
-
{ id:
|
|
63
|
-
{ id:
|
|
64
|
-
{ id:
|
|
65
|
-
{ id:
|
|
66
|
-
{ id:
|
|
67
|
-
{ id:
|
|
68
|
-
{ id:
|
|
61
|
+
{ id: "intro", duration: durations.intro },
|
|
62
|
+
{ id: "days", duration: durations.days },
|
|
63
|
+
{ id: "revenue", duration: durations.revenue },
|
|
64
|
+
{ id: "orders", duration: durations.orders },
|
|
65
|
+
{ id: "buyers", duration: durations.buyers },
|
|
66
|
+
{ id: "customer", duration: durations.customer },
|
|
67
|
+
{ id: "products", duration: durations.products },
|
|
68
|
+
{ id: "months", duration: durations.months },
|
|
69
|
+
{ id: "year", duration: durations.year },
|
|
70
|
+
{ id: "final", duration: durations.final },
|
|
69
71
|
];
|
|
70
|
-
const slides = isNewUser
|
|
72
|
+
const slides = isNewUser
|
|
73
|
+
? [{ id: "intro", duration: durations.intro }]
|
|
74
|
+
: fullSlideSet;
|
|
71
75
|
|
|
72
76
|
const currentSlide = slides[activeIndex];
|
|
73
|
-
const isFinalSlide = currentSlide.id ===
|
|
77
|
+
const isFinalSlide = currentSlide.id === "final";
|
|
78
|
+
|
|
79
|
+
// Pre-capture screenshot and show share button when ready
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
// Hide share button immediately on slide change
|
|
82
|
+
setIsShareVisible(false);
|
|
83
|
+
|
|
84
|
+
if (isFinalSlide || !slidesContainerRef.current) return;
|
|
85
|
+
|
|
86
|
+
let isMounted = true;
|
|
87
|
+
|
|
88
|
+
// Wait for animations to complete, then pre-capture
|
|
89
|
+
const timer = setTimeout(async () => {
|
|
90
|
+
if (!isMounted || !slidesContainerRef.current) return;
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
// Pre-capture the screenshot
|
|
94
|
+
await preCaptureSlide(slidesContainerRef.current, {
|
|
95
|
+
slideId: currentSlide.id,
|
|
96
|
+
businessName: recapData.businessName,
|
|
97
|
+
year: recapData.year ?? 2025,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Only show share button AFTER pre-capture is complete
|
|
101
|
+
if (isMounted) {
|
|
102
|
+
setIsShareVisible(true);
|
|
103
|
+
}
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error('[RecapStory] Pre-capture failed:', error);
|
|
106
|
+
// Still show share button even if pre-capture fails (will fall back to download)
|
|
107
|
+
if (isMounted) {
|
|
108
|
+
setIsShareVisible(true);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, 2500); // Wait 2.5s for all animations to complete
|
|
112
|
+
|
|
113
|
+
return () => {
|
|
114
|
+
isMounted = false;
|
|
115
|
+
clearTimeout(timer);
|
|
116
|
+
};
|
|
117
|
+
}, [activeIndex, currentSlide.id, recapData.businessName, recapData.year, isFinalSlide]);
|
|
74
118
|
|
|
75
119
|
// Ensure music plays only on slides 1-9 and stops immediately on the final slide
|
|
76
120
|
React.useEffect(() => {
|
|
@@ -79,10 +123,10 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
79
123
|
return;
|
|
80
124
|
}
|
|
81
125
|
|
|
82
|
-
if (
|
|
126
|
+
if (!isPlaying) {
|
|
83
127
|
play();
|
|
84
128
|
}
|
|
85
|
-
}, [isFinalSlide,
|
|
129
|
+
}, [isFinalSlide, isPlaying, play, stop]);
|
|
86
130
|
|
|
87
131
|
// Stop music when reaching the final slide (safety net)
|
|
88
132
|
React.useEffect(() => {
|
|
@@ -97,25 +141,56 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
97
141
|
}
|
|
98
142
|
|
|
99
143
|
if (activeIndex < slides.length - 1) {
|
|
100
|
-
setActiveIndex(prev => prev + 1);
|
|
144
|
+
setActiveIndex((prev) => prev + 1);
|
|
145
|
+
setIsPaused(false);
|
|
101
146
|
}
|
|
102
147
|
};
|
|
103
148
|
|
|
104
149
|
const handleReplay = () => {
|
|
105
150
|
setActiveIndex(0);
|
|
106
|
-
|
|
151
|
+
setIsPaused(false);
|
|
107
152
|
};
|
|
108
153
|
|
|
109
154
|
// Jump to specific slide when bar is clicked
|
|
110
155
|
const handleBarClick = (index: number) => {
|
|
111
156
|
setActiveIndex(index);
|
|
157
|
+
setIsPaused(false);
|
|
112
158
|
};
|
|
113
159
|
|
|
114
|
-
// Handle
|
|
115
|
-
const
|
|
160
|
+
// Handle hold to pause
|
|
161
|
+
const handlePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {
|
|
162
|
+
// Ignore if on interactive elements
|
|
163
|
+
const target = event.target as HTMLElement;
|
|
164
|
+
if (target.tagName === "BUTTON" || target.closest("button")) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
isHoldingRef.current = false;
|
|
169
|
+
|
|
170
|
+
// Start hold timer - pause after 150ms of holding
|
|
171
|
+
holdTimerRef.current = setTimeout(() => {
|
|
172
|
+
isHoldingRef.current = true;
|
|
173
|
+
setIsPaused(true);
|
|
174
|
+
}, 150);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const handlePointerUp = (event: React.PointerEvent<HTMLDivElement>) => {
|
|
178
|
+
// Clear hold timer
|
|
179
|
+
if (holdTimerRef.current) {
|
|
180
|
+
clearTimeout(holdTimerRef.current);
|
|
181
|
+
holdTimerRef.current = null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// If was holding, just unpause and don't navigate
|
|
185
|
+
if (isHoldingRef.current) {
|
|
186
|
+
isHoldingRef.current = false;
|
|
187
|
+
setIsPaused(false);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
116
191
|
// Ignore clicks on interactive elements
|
|
117
192
|
const target = event.target as HTMLElement;
|
|
118
|
-
if (target.tagName ===
|
|
193
|
+
if (target.tagName === "BUTTON" || target.closest("button")) {
|
|
119
194
|
return;
|
|
120
195
|
}
|
|
121
196
|
|
|
@@ -123,82 +198,102 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
123
198
|
const rect = container.getBoundingClientRect();
|
|
124
199
|
const tapX = event.clientX - rect.left;
|
|
125
200
|
const screenWidth = rect.width;
|
|
126
|
-
|
|
127
|
-
// Left
|
|
128
|
-
if (tapX < screenWidth
|
|
201
|
+
|
|
202
|
+
// Left 20% of screen = previous slide
|
|
203
|
+
if (tapX < screenWidth * 0.2) {
|
|
129
204
|
if (activeIndex > 0) {
|
|
130
|
-
setActiveIndex(prev => prev - 1);
|
|
205
|
+
setActiveIndex((prev) => prev - 1);
|
|
206
|
+
setIsPaused(false);
|
|
131
207
|
}
|
|
132
|
-
}
|
|
133
|
-
// Right
|
|
134
|
-
else {
|
|
208
|
+
}
|
|
209
|
+
// Right 20% of screen = next slide
|
|
210
|
+
else if (tapX > screenWidth * 0.8) {
|
|
135
211
|
if (!isFinalSlide && activeIndex < slides.length - 1) {
|
|
136
|
-
setActiveIndex(prev => prev + 1);
|
|
212
|
+
setActiveIndex((prev) => prev + 1);
|
|
213
|
+
setIsPaused(false);
|
|
137
214
|
}
|
|
138
215
|
}
|
|
216
|
+
// Middle 60% = no navigation, just tap (already handled by hold logic)
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const handlePointerLeave = () => {
|
|
220
|
+
// Clear hold timer and unpause if leaving
|
|
221
|
+
if (holdTimerRef.current) {
|
|
222
|
+
clearTimeout(holdTimerRef.current);
|
|
223
|
+
holdTimerRef.current = null;
|
|
224
|
+
}
|
|
225
|
+
if (isHoldingRef.current) {
|
|
226
|
+
isHoldingRef.current = false;
|
|
227
|
+
setIsPaused(false);
|
|
228
|
+
}
|
|
139
229
|
};
|
|
140
230
|
|
|
141
231
|
// Render current slide content
|
|
142
232
|
const renderSlide = () => {
|
|
143
233
|
switch (currentSlide.id) {
|
|
144
|
-
case
|
|
234
|
+
case "intro":
|
|
145
235
|
return (
|
|
146
|
-
<Slide1Intro
|
|
236
|
+
<Slide1Intro
|
|
147
237
|
businessName={recapData.businessName}
|
|
148
238
|
businessCategory={recapData.businessCategory}
|
|
149
239
|
introHeadline={recapData.introHeadline}
|
|
150
240
|
introSubtitle={recapData.introSubtitle}
|
|
151
|
-
|
|
241
|
+
frameImages={recapData.productImages}
|
|
152
242
|
/>
|
|
153
243
|
);
|
|
154
|
-
case
|
|
244
|
+
case "days":
|
|
155
245
|
return (
|
|
156
|
-
<Slide2Days
|
|
246
|
+
<Slide2Days
|
|
157
247
|
days={recapData.days}
|
|
158
248
|
streak={recapData.streak}
|
|
249
|
+
frameImages={recapData.productImages}
|
|
159
250
|
/>
|
|
160
251
|
);
|
|
161
|
-
case
|
|
252
|
+
case "revenue":
|
|
162
253
|
return (
|
|
163
|
-
<Slide3Revenue
|
|
254
|
+
<Slide3Revenue
|
|
164
255
|
revenue={recapData.revenue}
|
|
165
256
|
currency={recapData.currency}
|
|
166
257
|
businessCategory={recapData.businessCategory}
|
|
167
258
|
/>
|
|
168
259
|
);
|
|
169
|
-
case
|
|
260
|
+
case "orders":
|
|
170
261
|
return (
|
|
171
262
|
<Slide4Orders
|
|
172
263
|
orders={recapData.orders}
|
|
264
|
+
frameImages={recapData.productImages}
|
|
173
265
|
/>
|
|
174
266
|
);
|
|
175
|
-
case
|
|
267
|
+
case "buyers":
|
|
176
268
|
return (
|
|
177
269
|
<Slide5Buyers
|
|
178
270
|
firstTimeBuyers={recapData.firstTimeBuyers}
|
|
179
271
|
repeatBuyers={recapData.repeatBuyers}
|
|
272
|
+
frameImages={recapData.productImages}
|
|
180
273
|
/>
|
|
181
274
|
);
|
|
182
|
-
case
|
|
183
|
-
return (
|
|
184
|
-
<Slide6Customer customerName={recapData.topCustomerName} />
|
|
185
|
-
);
|
|
186
|
-
case 'products':
|
|
275
|
+
case "customer":
|
|
187
276
|
return (
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
277
|
+
<Slide6Customer
|
|
278
|
+
websiteLink={recapData.websiteLink ?? ""}
|
|
279
|
+
websiteVisits={recapData.websiteVisits ?? 0}
|
|
280
|
+
mostViewedProduct={recapData.mostViewedProduct ?? ""}
|
|
281
|
+
mostViewedProductCount={recapData.mostViewedProductCount ?? 0}
|
|
282
|
+
/>
|
|
193
283
|
);
|
|
194
|
-
case
|
|
284
|
+
case "products":
|
|
285
|
+
return <Slide7Products products={recapData.topProducts} />;
|
|
286
|
+
case "months":
|
|
287
|
+
return <Slide8Months busiestMonth={recapData.busiestMonth} />;
|
|
288
|
+
case "year":
|
|
195
289
|
return (
|
|
196
|
-
<Slide9Year
|
|
290
|
+
<Slide9Year
|
|
197
291
|
businessCategory={recapData.businessCategory}
|
|
198
292
|
year={recapData.year}
|
|
293
|
+
frameImages={recapData.productImages}
|
|
199
294
|
/>
|
|
200
295
|
);
|
|
201
|
-
case
|
|
296
|
+
case "final":
|
|
202
297
|
return (
|
|
203
298
|
<Slide10Final
|
|
204
299
|
videoUrl={recapData.videoUrl}
|
|
@@ -218,48 +313,38 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
218
313
|
<div className="recap-story__top-group">
|
|
219
314
|
{/* Header with Huxxle logo and Recap badge */}
|
|
220
315
|
<div className="recap-story__header-wrapper">
|
|
221
|
-
<Header
|
|
222
|
-
showRecapBadge={true}
|
|
223
|
-
badgeVariant={isNewUser ?
|
|
316
|
+
<Header
|
|
317
|
+
showRecapBadge={true}
|
|
318
|
+
badgeVariant={isNewUser ? "new-user" : "default"}
|
|
224
319
|
year={recapData.year}
|
|
225
320
|
/>
|
|
226
321
|
</div>
|
|
227
322
|
|
|
228
|
-
{/* Progress bars
|
|
323
|
+
{/* Progress bars */}
|
|
229
324
|
<div className="recap-story__progress-wrap">
|
|
230
325
|
<div className="recap-story__progress">
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
)}
|
|
326
|
+
<StoryProgress
|
|
327
|
+
total={slides.length}
|
|
328
|
+
active={activeIndex}
|
|
329
|
+
duration={currentSlide.duration}
|
|
330
|
+
onComplete={handleProgressComplete}
|
|
331
|
+
onBarClick={handleBarClick}
|
|
332
|
+
hideBorder={isFinalSlide}
|
|
333
|
+
isPaused={isPaused}
|
|
334
|
+
/>
|
|
241
335
|
</div>
|
|
242
|
-
|
|
243
|
-
{!isFinalSlide && (
|
|
244
|
-
<button
|
|
245
|
-
type="button"
|
|
246
|
-
className="recap-story__sound-toggle"
|
|
247
|
-
onClick={toggleMute}
|
|
248
|
-
aria-label={isMuted ? 'Unmute sound' : 'Mute sound'}
|
|
249
|
-
>
|
|
250
|
-
<img
|
|
251
|
-
src={isMuted ? soundOffIcon : soundOnIcon}
|
|
252
|
-
alt={isMuted ? 'Unmute sound' : 'Mute sound'}
|
|
253
|
-
className="recap-story__sound-icon"
|
|
254
|
-
draggable={false}
|
|
255
|
-
/>
|
|
256
|
-
</button>
|
|
257
|
-
)}
|
|
258
336
|
</div>
|
|
259
337
|
</div>
|
|
260
338
|
|
|
261
339
|
{/* Slide content with transitions */}
|
|
262
|
-
<div
|
|
340
|
+
<div
|
|
341
|
+
className="recap-story__slides"
|
|
342
|
+
ref={slidesContainerRef}
|
|
343
|
+
onPointerDown={handlePointerDown}
|
|
344
|
+
onPointerUp={handlePointerUp}
|
|
345
|
+
onPointerLeave={handlePointerLeave}
|
|
346
|
+
onPointerCancel={handlePointerLeave}
|
|
347
|
+
>
|
|
263
348
|
<AnimatePresence mode="wait">
|
|
264
349
|
<motion.div
|
|
265
350
|
key={currentSlide.id}
|
|
@@ -273,6 +358,52 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
273
358
|
</motion.div>
|
|
274
359
|
</AnimatePresence>
|
|
275
360
|
</div>
|
|
361
|
+
|
|
362
|
+
{/* Floating buttons - Sound and Share (only on slides 1-9, hidden for video and new users) */}
|
|
363
|
+
{!isFinalSlide && !recapData.isVideo && (
|
|
364
|
+
<>
|
|
365
|
+
{/* Sound button - always visible, independent of share state */}
|
|
366
|
+
<button
|
|
367
|
+
className="recap-story__floating-btn recap-story__sound-btn"
|
|
368
|
+
onClick={toggleMute}
|
|
369
|
+
aria-label={isMuted ? "Unmute" : "Mute"}
|
|
370
|
+
>
|
|
371
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
372
|
+
<path d="M1.66675 8.83333V11.1667C1.66675 13 2.50008 13.8333 4.33341 13.8333H5.51675C5.82508 13.8333 6.12508 13.9417 6.36675 14.1333L8.68341 16.0167C10.3167 17.4 12.5001 16.325 12.5001 14.2333V5.76667C12.5001 3.66667 10.3167 2.6 8.68341 3.98333L6.36675 5.86667C6.12508 6.05833 5.82508 6.16667 5.51675 6.16667H4.33341C2.50008 6.16667 1.66675 7 1.66675 8.83333Z" stroke="#4F4CD8" strokeWidth="1.5"/>
|
|
373
|
+
{!isMuted && (
|
|
374
|
+
<>
|
|
375
|
+
<path d="M15 6.66667C16.3834 8.30834 16.3834 11.7 15 13.3333" stroke="#4F4CD8" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
376
|
+
<path d="M16.825 4.58334C19.3917 7.59168 19.3917 12.4167 16.825 15.4167" stroke="#4F4CD8" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
377
|
+
</>
|
|
378
|
+
)}
|
|
379
|
+
</svg>
|
|
380
|
+
</button>
|
|
381
|
+
|
|
382
|
+
{/* Share button - fades in after counter animations (hidden for new users) */}
|
|
383
|
+
{!isNewUser && (
|
|
384
|
+
<button
|
|
385
|
+
className={`recap-story__floating-btn recap-story__share-btn ${isShareVisible ? 'recap-story__share-btn--visible' : ''}`}
|
|
386
|
+
onClick={() => {
|
|
387
|
+
// Call without await - the function handles sharing internally
|
|
388
|
+
// This preserves the user gesture chain for mobile Web Share API
|
|
389
|
+
captureAndShareSlide(slidesContainerRef.current, {
|
|
390
|
+
slideId: currentSlide.id,
|
|
391
|
+
businessName: recapData.businessName,
|
|
392
|
+
year: recapData.year ?? new Date().getFullYear(),
|
|
393
|
+
});
|
|
394
|
+
}}
|
|
395
|
+
aria-label="Share"
|
|
396
|
+
>
|
|
397
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
398
|
+
<path d="M13.7 7.4165C16.7 7.67484 17.925 9.2165 17.925 12.5915V12.6998C17.925 16.4248 16.4333 17.9165 12.7083 17.9165H7.28332C3.55832 17.9165 2.06665 16.4248 2.06665 12.6998V12.5915C2.06665 9.2415 3.27498 7.69984 6.22498 7.42484" stroke="#4F4CD8" strokeLinecap="round" strokeLinejoin="round"/>
|
|
399
|
+
<path d="M10 12.4999V3.0166" stroke="#4F4CD8" strokeLinecap="round" strokeLinejoin="round"/>
|
|
400
|
+
<path d="M12.7916 4.87516L9.99998 2.0835L7.20831 4.87516" stroke="#4F4CD8" strokeLinecap="round" strokeLinejoin="round"/>
|
|
401
|
+
</svg>
|
|
402
|
+
<span className="recap-story__share-text">Share</span>
|
|
403
|
+
</button>
|
|
404
|
+
)}
|
|
405
|
+
</>
|
|
406
|
+
)}
|
|
276
407
|
</div>
|
|
277
408
|
);
|
|
278
409
|
}
|
package/src/StoryProgress.css
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
width: 100%;
|
|
20
20
|
height: 100%;
|
|
21
21
|
background: transparent;
|
|
22
|
-
border: 0.5px solid rgba(
|
|
22
|
+
border: 0.5px solid rgba(55, 52, 211, 1);
|
|
23
23
|
border-radius: 2px;
|
|
24
24
|
overflow: hidden;
|
|
25
25
|
position: relative;
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.story-progress__bar.completed {
|
|
34
|
-
background: linear-gradient(90deg, #
|
|
34
|
+
background: linear-gradient(90deg, #4F4CD8 0%, #2A2872 100%);
|
|
35
35
|
border: none;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
left: 0;
|
|
42
42
|
width: 100%;
|
|
43
43
|
height: 100%;
|
|
44
|
-
background: linear-gradient(90deg, #
|
|
44
|
+
background: linear-gradient(90deg, #4F4CD8 0%, #2A2872 100%);
|
|
45
45
|
transform-origin: left;
|
|
46
46
|
transform: scaleX(0);
|
|
47
47
|
}
|