@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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ScreenshotOptions {
|
|
2
|
+
slideId: string;
|
|
3
|
+
businessName: string;
|
|
4
|
+
year: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Pre-captures a screenshot of the slide and caches it.
|
|
8
|
+
* Call this when a slide becomes active so the image is ready for instant sharing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function preCaptureSlide(containerRef: HTMLElement | null, options: ScreenshotOptions): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Clears the screenshot cache (call when leaving recap)
|
|
13
|
+
*/
|
|
14
|
+
export declare function clearScreenshotCache(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if a screenshot is cached for a specific slide
|
|
17
|
+
*/
|
|
18
|
+
export declare function isScreenshotCached(options: ScreenshotOptions): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Shares or downloads a slide screenshot.
|
|
21
|
+
* Uses cached screenshot if available (instant share), otherwise captures fresh.
|
|
22
|
+
*
|
|
23
|
+
* - Desktop: Downloads the image directly
|
|
24
|
+
* - Mobile: Uses Web Share API with file (same as Slide10Final)
|
|
25
|
+
*/
|
|
26
|
+
export declare function captureAndShareSlide(containerRef: HTMLElement | null, options: ScreenshotOptions): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=slideScreenshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slideScreenshot.d.ts","sourceRoot":"","sources":["../../src/utils/slideScreenshot.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAaD;;;GAGG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,WAAW,GAAG,IAAI,EAChC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAiEf;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAItE;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,WAAW,GAAG,IAAI,EAChC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAqIf"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import html2canvas from 'html2canvas';
|
|
2
|
+
// Cache for pre-captured screenshots
|
|
3
|
+
const screenshotCache = new Map();
|
|
4
|
+
/**
|
|
5
|
+
* Detects if the device is mobile
|
|
6
|
+
*/
|
|
7
|
+
function isMobileDevice() {
|
|
8
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||
|
|
9
|
+
(navigator.maxTouchPoints > 0 && window.innerWidth < 768);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Pre-captures a screenshot of the slide and caches it.
|
|
13
|
+
* Call this when a slide becomes active so the image is ready for instant sharing.
|
|
14
|
+
*/
|
|
15
|
+
export async function preCaptureSlide(containerRef, options) {
|
|
16
|
+
if (!containerRef)
|
|
17
|
+
return;
|
|
18
|
+
const { slideId, businessName, year } = options;
|
|
19
|
+
const cacheKey = `${businessName}-${year}-${slideId}`;
|
|
20
|
+
// Skip if already cached
|
|
21
|
+
if (screenshotCache.has(cacheKey)) {
|
|
22
|
+
console.log('[Screenshot] Using cached screenshot for:', cacheKey);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const storyContainer = containerRef.closest('.recap-story');
|
|
26
|
+
if (!storyContainer)
|
|
27
|
+
return;
|
|
28
|
+
try {
|
|
29
|
+
console.log('[Screenshot] Pre-capturing slide:', slideId);
|
|
30
|
+
const canvas = await html2canvas(storyContainer, {
|
|
31
|
+
scale: 3, // Higher scale for better image quality
|
|
32
|
+
useCORS: true,
|
|
33
|
+
allowTaint: true,
|
|
34
|
+
backgroundColor: '#FCFCFC',
|
|
35
|
+
logging: false,
|
|
36
|
+
windowWidth: storyContainer.scrollWidth,
|
|
37
|
+
windowHeight: storyContainer.scrollHeight,
|
|
38
|
+
ignoreElements: (element) => {
|
|
39
|
+
// Ignore buttons and progress bar - they're excluded from screenshot
|
|
40
|
+
return element.classList.contains('recap-story__sound-btn') ||
|
|
41
|
+
element.classList.contains('recap-story__share-btn') ||
|
|
42
|
+
element.classList.contains('recap-story__progress-wrap');
|
|
43
|
+
},
|
|
44
|
+
// Apply screenshot-mode to cloned DOM only (not visible to user)
|
|
45
|
+
onclone: (clonedDoc) => {
|
|
46
|
+
const clonedContainer = clonedDoc.querySelector('.recap-story');
|
|
47
|
+
if (clonedContainer) {
|
|
48
|
+
clonedContainer.classList.add('screenshot-mode');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const blob = await new Promise((resolve, reject) => {
|
|
53
|
+
canvas.toBlob((b) => {
|
|
54
|
+
if (b)
|
|
55
|
+
resolve(b);
|
|
56
|
+
else
|
|
57
|
+
reject(new Error('Failed to create blob'));
|
|
58
|
+
}, 'image/png', 1.0);
|
|
59
|
+
});
|
|
60
|
+
const mimeType = 'image/png';
|
|
61
|
+
const fileName = `${businessName.replace(/\s+/g, '-')}-recap-${year}-${slideId}.png`;
|
|
62
|
+
const file = new File([blob], fileName, {
|
|
63
|
+
type: mimeType,
|
|
64
|
+
lastModified: Date.now()
|
|
65
|
+
});
|
|
66
|
+
screenshotCache.set(cacheKey, file);
|
|
67
|
+
console.log('[Screenshot] Pre-capture complete:', cacheKey, file.size, 'bytes');
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error('[Screenshot] Pre-capture failed:', error);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Clears the screenshot cache (call when leaving recap)
|
|
75
|
+
*/
|
|
76
|
+
export function clearScreenshotCache() {
|
|
77
|
+
screenshotCache.clear();
|
|
78
|
+
console.log('[Screenshot] Cache cleared');
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check if a screenshot is cached for a specific slide
|
|
82
|
+
*/
|
|
83
|
+
export function isScreenshotCached(options) {
|
|
84
|
+
const { slideId, businessName, year } = options;
|
|
85
|
+
const cacheKey = `${businessName}-${year}-${slideId}`;
|
|
86
|
+
return screenshotCache.has(cacheKey);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Shares or downloads a slide screenshot.
|
|
90
|
+
* Uses cached screenshot if available (instant share), otherwise captures fresh.
|
|
91
|
+
*
|
|
92
|
+
* - Desktop: Downloads the image directly
|
|
93
|
+
* - Mobile: Uses Web Share API with file (same as Slide10Final)
|
|
94
|
+
*/
|
|
95
|
+
export async function captureAndShareSlide(containerRef, options) {
|
|
96
|
+
if (!containerRef) {
|
|
97
|
+
console.error('[Screenshot] No container element provided');
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const { slideId, businessName, year } = options;
|
|
101
|
+
const cacheKey = `${businessName}-${year}-${slideId}`;
|
|
102
|
+
const isMobile = isMobileDevice();
|
|
103
|
+
console.log('[Screenshot] Device type:', isMobile ? 'mobile' : 'desktop');
|
|
104
|
+
console.log('[Screenshot] Cache key:', cacheKey);
|
|
105
|
+
// Check for cached screenshot (enables instant sharing on mobile)
|
|
106
|
+
const cachedFile = screenshotCache.get(cacheKey);
|
|
107
|
+
console.log('[Screenshot] Cache available:', !!cachedFile);
|
|
108
|
+
// MOBILE: Must use cached file for instant share (user gesture chain)
|
|
109
|
+
if (isMobile) {
|
|
110
|
+
if (cachedFile) {
|
|
111
|
+
console.log('[Screenshot] Using cached file for instant share');
|
|
112
|
+
// CRITICAL: Call navigator.share() directly without any await before it
|
|
113
|
+
// to maintain the user gesture chain on mobile browsers (especially Edge)
|
|
114
|
+
const canShareFiles = navigator.canShare && navigator.canShare({ files: [cachedFile] });
|
|
115
|
+
console.log('[Screenshot] Can share files:', canShareFiles);
|
|
116
|
+
if (canShareFiles) {
|
|
117
|
+
// Call share synchronously - no try/catch wrapper that could break gesture chain
|
|
118
|
+
navigator.share({
|
|
119
|
+
files: [cachedFile],
|
|
120
|
+
title: 'My Huxxle Recap',
|
|
121
|
+
text: `Check out ${businessName}'s Wrapped ${year} highlights! 🎉`
|
|
122
|
+
}).then(() => {
|
|
123
|
+
console.log('[Screenshot] Share successful!');
|
|
124
|
+
}).catch((err) => {
|
|
125
|
+
console.error('[Screenshot] Share failed:', err);
|
|
126
|
+
// If user cancelled (AbortError), don't download
|
|
127
|
+
if (err.name !== 'AbortError') {
|
|
128
|
+
// Fallback to download on share failure
|
|
129
|
+
const blob = new Blob([cachedFile], { type: cachedFile.type });
|
|
130
|
+
downloadImage(blob, cachedFile.name);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
// Mobile browser doesn't support file sharing - download instead
|
|
136
|
+
console.log('[Screenshot] File sharing not supported, downloading...');
|
|
137
|
+
const blob = new Blob([cachedFile], { type: cachedFile.type });
|
|
138
|
+
downloadImage(blob, cachedFile.name);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// No cache on mobile - this shouldn't happen if timing is correct
|
|
142
|
+
// Fall back to capturing and downloading (share won't work due to gesture chain)
|
|
143
|
+
console.warn('[Screenshot] No cache on mobile - falling back to capture + download');
|
|
144
|
+
// Continue to fresh capture below, but it will download instead of share
|
|
145
|
+
}
|
|
146
|
+
// DESKTOP or MOBILE-FALLBACK: Capture fresh screenshot
|
|
147
|
+
const storyContainer = containerRef.closest('.recap-story');
|
|
148
|
+
if (!storyContainer) {
|
|
149
|
+
console.error('[Screenshot] Could not find .recap-story container');
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
console.log('[Screenshot] Starting capture...');
|
|
154
|
+
const canvas = await html2canvas(storyContainer, {
|
|
155
|
+
scale: 3, // Higher scale for better image quality
|
|
156
|
+
useCORS: true,
|
|
157
|
+
allowTaint: true,
|
|
158
|
+
backgroundColor: '#FCFCFC',
|
|
159
|
+
logging: false,
|
|
160
|
+
windowWidth: storyContainer.scrollWidth,
|
|
161
|
+
windowHeight: storyContainer.scrollHeight,
|
|
162
|
+
ignoreElements: (element) => {
|
|
163
|
+
// Ignore buttons and progress bar - they're excluded from screenshot
|
|
164
|
+
return element.classList.contains('recap-story__sound-btn') ||
|
|
165
|
+
element.classList.contains('recap-story__share-btn') ||
|
|
166
|
+
element.classList.contains('recap-story__progress-wrap');
|
|
167
|
+
},
|
|
168
|
+
// Apply screenshot-mode to cloned DOM only (not visible to user)
|
|
169
|
+
onclone: (clonedDoc) => {
|
|
170
|
+
const clonedContainer = clonedDoc.querySelector('.recap-story');
|
|
171
|
+
if (clonedContainer) {
|
|
172
|
+
clonedContainer.classList.add('screenshot-mode');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
console.log('[Screenshot] Canvas created:', canvas.width, 'x', canvas.height);
|
|
177
|
+
const blob = await new Promise((resolve, reject) => {
|
|
178
|
+
canvas.toBlob((b) => {
|
|
179
|
+
if (b)
|
|
180
|
+
resolve(b);
|
|
181
|
+
else
|
|
182
|
+
reject(new Error('Failed to create blob'));
|
|
183
|
+
}, 'image/png', 1.0);
|
|
184
|
+
});
|
|
185
|
+
console.log('[Screenshot] Blob created:', blob.size, 'bytes');
|
|
186
|
+
const mimeType = 'image/png';
|
|
187
|
+
const fileName = `${businessName.replace(/\s+/g, '-')}-recap-${year}-${slideId}.png`;
|
|
188
|
+
// DESKTOP: Always download
|
|
189
|
+
if (!isMobile) {
|
|
190
|
+
console.log('[Screenshot] Desktop - downloading...');
|
|
191
|
+
downloadImage(blob, fileName);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
// MOBILE (no cache): Try to share, likely will fail due to user gesture timing
|
|
195
|
+
const file = new File([blob], fileName, {
|
|
196
|
+
type: mimeType,
|
|
197
|
+
lastModified: Date.now()
|
|
198
|
+
});
|
|
199
|
+
// Cache for next time
|
|
200
|
+
screenshotCache.set(cacheKey, file);
|
|
201
|
+
await shareFile(file, businessName, year);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
console.error('[Screenshot] Capture failed:', error);
|
|
205
|
+
}
|
|
206
|
+
finally {
|
|
207
|
+
storyContainer.classList.remove('screenshot-mode');
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Shares a file using Web Share API with fallbacks
|
|
212
|
+
*/
|
|
213
|
+
async function shareFile(file, businessName, year) {
|
|
214
|
+
console.log('[Screenshot] File to share:', file.name, file.type, file.size, 'bytes');
|
|
215
|
+
// Validate file size (WhatsApp limit: 5MB for images)
|
|
216
|
+
const maxSize = 5 * 1024 * 1024;
|
|
217
|
+
if (file.size > maxSize) {
|
|
218
|
+
alert('File is too large. Maximum size is 5MB');
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
// Check if Web Share API with files is supported
|
|
222
|
+
const canShareFiles = navigator.canShare && navigator.canShare({ files: [file] });
|
|
223
|
+
console.log('[Screenshot] Can share files:', canShareFiles);
|
|
224
|
+
// Try sharing with file
|
|
225
|
+
if (canShareFiles) {
|
|
226
|
+
console.log('[Screenshot] Sharing file...');
|
|
227
|
+
try {
|
|
228
|
+
await navigator.share({
|
|
229
|
+
files: [file],
|
|
230
|
+
title: 'My Huxxle Recap',
|
|
231
|
+
text: `Check out ${businessName}'s Wrapped ${year} highlights! 🎉`
|
|
232
|
+
});
|
|
233
|
+
console.log('[Screenshot] Share successful!');
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
catch (shareError) {
|
|
237
|
+
console.error('[Screenshot] File share failed:', shareError);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Fallback: share URL only
|
|
241
|
+
if (navigator.share) {
|
|
242
|
+
console.log('[Screenshot] Sharing URL fallback...');
|
|
243
|
+
try {
|
|
244
|
+
await navigator.share({
|
|
245
|
+
title: 'My Huxxle Recap',
|
|
246
|
+
text: `Check out ${businessName}'s Wrapped ${year} highlights! 🎉`,
|
|
247
|
+
url: window.location.href
|
|
248
|
+
});
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
catch (urlShareError) {
|
|
252
|
+
console.error('[Screenshot] URL share failed:', urlShareError);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Final fallback: download
|
|
256
|
+
console.log('[Screenshot] Download fallback...');
|
|
257
|
+
const blob = new Blob([await file.arrayBuffer()], { type: file.type });
|
|
258
|
+
downloadImage(blob, file.name);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Downloads an image blob
|
|
262
|
+
*/
|
|
263
|
+
function downloadImage(blob, fileName) {
|
|
264
|
+
console.log('[Screenshot] Downloading:', fileName);
|
|
265
|
+
const url = URL.createObjectURL(blob);
|
|
266
|
+
const a = document.createElement('a');
|
|
267
|
+
a.href = url;
|
|
268
|
+
a.download = fileName;
|
|
269
|
+
document.body.appendChild(a);
|
|
270
|
+
a.click();
|
|
271
|
+
document.body.removeChild(a);
|
|
272
|
+
URL.revokeObjectURL(url);
|
|
273
|
+
console.log('[Screenshot] Download complete');
|
|
274
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@katajere/recap",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Vendor Year in Review Experience - Recap your business metrics for 2025",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"framer-motion": "^12.0.0",
|
|
55
|
+
"html2canvas": "^1.4.1",
|
|
55
56
|
"react": "^18.0.0 || ^19.0.0",
|
|
56
57
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
57
58
|
},
|
package/src/App.css
CHANGED
|
@@ -2,8 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
4
|
--frame-ar-num: 9;
|
|
5
|
-
--frame-ar-den:
|
|
6
|
-
--frame-ar: 9 /
|
|
5
|
+
--frame-ar-den: 16;
|
|
6
|
+
--frame-ar: 9 / 16;
|
|
7
|
+
|
|
8
|
+
/* Primary Colors */
|
|
9
|
+
--primary-blue: #4F4CD8;
|
|
10
|
+
--primary-purple: #3734D3;
|
|
11
|
+
--primary-dark: #2A2872;
|
|
12
|
+
|
|
13
|
+
/* Text Colors */
|
|
14
|
+
--text-primary: #3734D3;
|
|
15
|
+
--text-white: #FCFCFC;
|
|
16
|
+
--text-secondary: rgba(55, 52, 211, 0.89);
|
|
17
|
+
|
|
18
|
+
/* secondary colors */
|
|
19
|
+
--secondary-blue: #2D2ABF;
|
|
20
|
+
--secondary-dark: #211F8F;
|
|
21
|
+
--border-line: #CDCCF4;
|
|
22
|
+
--rect-border: #817FE3;
|
|
23
|
+
|
|
24
|
+
/* Background */
|
|
25
|
+
--bg-white: #FFFFFF;
|
|
26
|
+
--bg-gradient: linear-gradient(90deg, #4F4CD8 0%, #2A2872 100%);
|
|
7
27
|
}
|
|
8
28
|
|
|
9
29
|
* {
|
|
@@ -60,9 +80,10 @@ body {
|
|
|
60
80
|
aspect-ratio: var(--frame-ar);
|
|
61
81
|
width: min(100%, calc(100dvh * var(--frame-ar-num) / var(--frame-ar-den)));
|
|
62
82
|
height: min(100dvh, calc(100vw * var(--frame-ar-den) / var(--frame-ar-num)));
|
|
63
|
-
max-width:
|
|
64
|
-
max-height:
|
|
65
|
-
background:
|
|
83
|
+
max-width: 1080px;
|
|
84
|
+
max-height: 1920px;
|
|
85
|
+
background: var(--bg-white) url('./assets/noisy-background.png') repeat;
|
|
86
|
+
background-size: 390px 844px;
|
|
66
87
|
/* border-radius: clamp(0px, 2vw, 24px); */
|
|
67
88
|
overflow: hidden;
|
|
68
89
|
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
|
@@ -72,14 +93,14 @@ body {
|
|
|
72
93
|
}
|
|
73
94
|
|
|
74
95
|
/* Fallback for browsers without aspect-ratio support */
|
|
75
|
-
@supports not (aspect-ratio: 9 /
|
|
96
|
+
@supports not (aspect-ratio: 9 / 16) {
|
|
76
97
|
.app__shell {
|
|
77
98
|
width: 100vw;
|
|
78
99
|
height: calc(100vw * var(--frame-ar-den) / var(--frame-ar-num));
|
|
79
100
|
max-height: 100dvh;
|
|
80
101
|
}
|
|
81
102
|
|
|
82
|
-
@media (min-aspect-ratio: 9/
|
|
103
|
+
@media (min-aspect-ratio: 9/16) {
|
|
83
104
|
.app__shell {
|
|
84
105
|
width: calc(100dvh * var(--frame-ar-num) / var(--frame-ar-den));
|
|
85
106
|
height: 100dvh;
|
|
@@ -88,9 +109,8 @@ body {
|
|
|
88
109
|
}
|
|
89
110
|
|
|
90
111
|
/* Mobile - remove border radius and shadow */
|
|
91
|
-
@media (max-width:
|
|
112
|
+
@media (max-width: 600px) {
|
|
92
113
|
.app {
|
|
93
|
-
background: linear-gradient(180deg, #3F3DAD 0%, #CC6240 100%);
|
|
94
114
|
padding: 0;
|
|
95
115
|
}
|
|
96
116
|
|
|
@@ -101,10 +121,10 @@ body {
|
|
|
101
121
|
.app__shell {
|
|
102
122
|
/* border-radius: 0; */
|
|
103
123
|
box-shadow: none;
|
|
104
|
-
width:
|
|
124
|
+
width: 100vw;
|
|
105
125
|
height: 100dvh;
|
|
106
|
-
max-width:
|
|
107
|
-
max-height:
|
|
126
|
+
max-width: 100vw;
|
|
127
|
+
max-height: 100dvh;
|
|
108
128
|
}
|
|
109
129
|
}
|
|
110
130
|
|
package/src/LoginScreen.css
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
position: relative;
|
|
4
4
|
width: 100%;
|
|
5
5
|
height: 100%;
|
|
6
|
-
|
|
6
|
+
background: transparent;
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
@@ -39,13 +39,18 @@
|
|
|
39
39
|
font-size: clamp(48px, 18.46vw, 72px);
|
|
40
40
|
line-height: 1.28;
|
|
41
41
|
text-transform: capitalize;
|
|
42
|
-
|
|
43
|
-
-webkit-background-clip: text;
|
|
44
|
-
-webkit-text-fill-color: transparent;
|
|
45
|
-
background-clip: text;
|
|
42
|
+
color: var(--primary-blue);
|
|
46
43
|
margin: 0;
|
|
47
44
|
white-space: normal;
|
|
48
45
|
word-wrap: break-word;
|
|
46
|
+
display: inline;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.login-screen__title::after {
|
|
50
|
+
content: " 25'";
|
|
51
|
+
color: var(--bg-white);
|
|
52
|
+
-webkit-text-stroke: 1.5px var(--primary-blue);
|
|
53
|
+
paint-order: stroke fill;
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
.login-screen__subtitle {
|
|
@@ -54,11 +59,8 @@
|
|
|
54
59
|
font-style: normal;
|
|
55
60
|
font-weight: 400;
|
|
56
61
|
font-size: clamp(14px, 4.1vw, 16px);
|
|
57
|
-
line-height: 1.
|
|
58
|
-
|
|
59
|
-
-webkit-background-clip: text;
|
|
60
|
-
-webkit-text-fill-color: transparent;
|
|
61
|
-
background-clip: text;
|
|
62
|
+
line-height: 1.5;
|
|
63
|
+
color: var(--text-primary);
|
|
62
64
|
margin: 0;
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -87,8 +89,7 @@
|
|
|
87
89
|
font-weight: 400;
|
|
88
90
|
font-size: clamp(10px, 3.08vw, 12px);
|
|
89
91
|
line-height: 120%;
|
|
90
|
-
color:
|
|
91
|
-
opacity: 0.89;
|
|
92
|
+
color: var(--text-secondary);
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
.form-input {
|
|
@@ -96,23 +97,23 @@
|
|
|
96
97
|
display: flex;
|
|
97
98
|
flex-direction: row;
|
|
98
99
|
align-items: center;
|
|
99
|
-
padding:
|
|
100
|
+
padding: 12px 16px;
|
|
100
101
|
width: 100%;
|
|
101
|
-
height:
|
|
102
|
+
height: 48px;
|
|
102
103
|
min-height: 48px;
|
|
103
104
|
background: transparent;
|
|
104
|
-
border: 1px solid
|
|
105
|
+
border: 1px solid var(--primary-purple);
|
|
105
106
|
font-family: 'Lora', serif;
|
|
106
107
|
font-style: normal;
|
|
107
108
|
font-weight: 400;
|
|
108
109
|
font-size: clamp(14px, 4.1vw, 16px);
|
|
109
110
|
line-height: 120%;
|
|
110
|
-
color:
|
|
111
|
+
color: var(--text-primary);
|
|
111
112
|
outline: none;
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
.form-input::placeholder {
|
|
115
|
-
color:
|
|
116
|
+
color: var(--text-primary);
|
|
116
117
|
opacity: 0.7;
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -121,18 +122,18 @@
|
|
|
121
122
|
flex-direction: row;
|
|
122
123
|
justify-content: center;
|
|
123
124
|
align-items: center;
|
|
124
|
-
padding:
|
|
125
|
+
padding: 12px 16px;
|
|
125
126
|
width: 100%;
|
|
126
|
-
height:
|
|
127
|
+
height: 48px;
|
|
127
128
|
min-height: 48px;
|
|
128
|
-
background:
|
|
129
|
+
background: var(--bg-gradient);
|
|
129
130
|
border: none;
|
|
130
131
|
font-family: 'Lora', serif;
|
|
131
132
|
font-style: normal;
|
|
132
133
|
font-weight: 600;
|
|
133
134
|
font-size: clamp(14px, 4.1vw, 16px);
|
|
134
135
|
line-height: 120%;
|
|
135
|
-
color:
|
|
136
|
+
color: var(--text-white);
|
|
136
137
|
cursor: pointer;
|
|
137
138
|
transition: opacity 0.2s;
|
|
138
139
|
}
|
package/src/LoginScreen.tsx
CHANGED
|
@@ -35,7 +35,7 @@ function LoginScreen({ onSubmit }: LoginScreenProps) {
|
|
|
35
35
|
initial="initial"
|
|
36
36
|
animate="animate"
|
|
37
37
|
>
|
|
38
|
-
<h1 className="login-screen__title">Recap
|
|
38
|
+
<h1 className="login-screen__title">Recap</h1>
|
|
39
39
|
<p className="login-screen__subtitle">Welcome, Log in to Get Started</p>
|
|
40
40
|
</motion.div>
|
|
41
41
|
|
package/src/OtpScreen.css
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
position: relative;
|
|
4
4
|
width: 100%;
|
|
5
5
|
height: 100%;
|
|
6
|
+
background: transparent;
|
|
6
7
|
overflow: hidden;
|
|
7
8
|
display: flex;
|
|
8
9
|
flex-direction: column;
|
|
@@ -38,13 +39,18 @@
|
|
|
38
39
|
font-size: clamp(48px, 18.46vw, 72px);
|
|
39
40
|
line-height: 1.28;
|
|
40
41
|
text-transform: capitalize;
|
|
41
|
-
|
|
42
|
-
-webkit-background-clip: text;
|
|
43
|
-
-webkit-text-fill-color: transparent;
|
|
44
|
-
background-clip: text;
|
|
42
|
+
color: var(--primary-blue);
|
|
45
43
|
margin: 0;
|
|
46
44
|
white-space: normal;
|
|
47
45
|
word-wrap: break-word;
|
|
46
|
+
display: inline;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.otp-screen__title::after {
|
|
50
|
+
content: " 25'";
|
|
51
|
+
color: var(--bg-white);
|
|
52
|
+
-webkit-text-stroke: 1.5px var(--primary-blue);
|
|
53
|
+
paint-order: stroke fill;
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
.otp-screen__subtitle {
|
|
@@ -53,11 +59,8 @@
|
|
|
53
59
|
font-style: normal;
|
|
54
60
|
font-weight: 400;
|
|
55
61
|
font-size: clamp(14px, 4.1vw, 16px);
|
|
56
|
-
line-height: 1.
|
|
57
|
-
|
|
58
|
-
-webkit-background-clip: text;
|
|
59
|
-
-webkit-text-fill-color: transparent;
|
|
60
|
-
background-clip: text;
|
|
62
|
+
line-height: 1.5;
|
|
63
|
+
color: var(--text-primary);
|
|
61
64
|
margin: 0;
|
|
62
65
|
}
|
|
63
66
|
|
|
@@ -78,24 +81,24 @@
|
|
|
78
81
|
flex-direction: row;
|
|
79
82
|
justify-content: center;
|
|
80
83
|
align-items: center;
|
|
81
|
-
padding:
|
|
84
|
+
padding: 12px 16px;
|
|
82
85
|
flex: 1;
|
|
83
86
|
height: 100%;
|
|
84
|
-
border: 1px solid
|
|
87
|
+
border: 1px solid var(--primary-purple);
|
|
85
88
|
background: transparent;
|
|
86
89
|
font-family: 'Lora', serif;
|
|
87
90
|
font-style: normal;
|
|
88
91
|
font-weight: 600;
|
|
89
92
|
font-size: clamp(14px, 4.1vw, 16px);
|
|
90
93
|
line-height: 120%;
|
|
91
|
-
color:
|
|
94
|
+
color: var(--text-primary);
|
|
92
95
|
text-align: center;
|
|
93
96
|
outline: none;
|
|
94
97
|
width: 5.69%;
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
.otp-input::placeholder {
|
|
98
|
-
color:
|
|
101
|
+
color: var(--text-primary);
|
|
99
102
|
opacity: 0.7;
|
|
100
103
|
}
|
|
101
104
|
|
|
@@ -108,18 +111,18 @@
|
|
|
108
111
|
flex-direction: row;
|
|
109
112
|
justify-content: center;
|
|
110
113
|
align-items: center;
|
|
111
|
-
padding:
|
|
114
|
+
padding: 12px 16px;
|
|
112
115
|
width: 100%;
|
|
113
|
-
height:
|
|
116
|
+
height: 48px;
|
|
114
117
|
min-height: 48px;
|
|
115
|
-
background:
|
|
118
|
+
background: var(--bg-gradient);
|
|
116
119
|
border: none;
|
|
117
120
|
font-family: 'Lora', serif;
|
|
118
121
|
font-style: normal;
|
|
119
122
|
font-weight: 600;
|
|
120
123
|
font-size: clamp(14px, 4.1vw, 16px);
|
|
121
124
|
line-height: 120%;
|
|
122
|
-
color:
|
|
125
|
+
color: var(--text-white);
|
|
123
126
|
cursor: pointer;
|
|
124
127
|
transition: opacity 0.2s;
|
|
125
128
|
}
|
package/src/OtpScreen.tsx
CHANGED
|
@@ -65,7 +65,7 @@ function OtpScreen({ identifier, onSubmit, onBack }: OtpScreenProps) {
|
|
|
65
65
|
initial="initial"
|
|
66
66
|
animate="animate"
|
|
67
67
|
>
|
|
68
|
-
<h1 className="otp-screen__title">Recap
|
|
68
|
+
<h1 className="otp-screen__title">Recap</h1>
|
|
69
69
|
<p className="otp-screen__subtitle">Check your email or WhatsApp and enter the 6-digit OTP below</p>
|
|
70
70
|
</motion.div>
|
|
71
71
|
|