@katajere/recap 2.1.5 → 2.1.7

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.
@@ -23,8 +23,8 @@
23
23
  left: 50%;
24
24
  top: 16px;
25
25
  transform: translateX(-50%);
26
- /* Height calculated: from 16px top to 16px below link bar (link bar is at ~312px, height 36px) */
27
- height: clamp(280px, 41vh, 348px);
26
+ /* Height: ~41% of container height */
27
+ height: clamp(280px, 41%, 348px);
28
28
  animation: rectBounce1 3s ease-in-out infinite;
29
29
  }
30
30
 
@@ -32,10 +32,10 @@
32
32
  width: calc(100% - 64px);
33
33
  max-width: 334px;
34
34
  left: 50%;
35
- top: clamp(80px, 12vh, 108px);
35
+ top: clamp(80px, 12%, 108px);
36
36
  transform: translateX(-50%);
37
- /* Height calculated: from 108px top to 32px below link bar */
38
- height: clamp(220px, 32vh, 272px);
37
+ /* Height: ~32% of container height */
38
+ height: clamp(220px, 32%, 272px);
39
39
  animation: rectBounce2 3s ease-in-out infinite;
40
40
  }
41
41
 
@@ -53,12 +53,10 @@
53
53
  /* Globe icon wrapper */
54
54
  .slide6-customer__globe-wrapper {
55
55
  position: absolute;
56
- width: 24vw;
57
- max-width: 94px;
58
- min-width: 60px;
56
+ width: clamp(60px, 24%, 94px);
59
57
  aspect-ratio: 94 / 100;
60
58
  left: 50%;
61
- top: 18.5vh;
59
+ top: 18.5%;
62
60
  transform: translateX(-50%);
63
61
  display: flex;
64
62
  align-items: center;
@@ -79,13 +77,13 @@
79
77
  max-width: 302px;
80
78
  height: 36px;
81
79
  left: 50%;
82
- top: clamp(260px, 37vh, 312px);
80
+ top: clamp(260px, 37%, 312px);
83
81
  transform: translateX(-50%);
84
82
  display: flex;
85
83
  flex-direction: row;
86
84
  align-items: center;
87
85
  justify-content: space-evenly;
88
- padding: 8px;
86
+ /* padding: 8px; */
89
87
  gap: 8px;
90
88
  background: #FCFCFC;
91
89
  border: 1px solid #CDCCF4;
@@ -96,6 +94,7 @@
96
94
  width: 20px;
97
95
  height: 20px;
98
96
  flex-shrink: 0;
97
+ align-self: center;
99
98
  }
100
99
 
101
100
  .slide6-customer__link-text {
@@ -103,12 +102,13 @@
103
102
  font-style: normal;
104
103
  font-weight: 600;
105
104
  font-size: 12px;
106
- line-height: 120%;
105
+ line-height: 36px; /* Match link-bar height for vertical centering */
107
106
  text-align: center;
108
107
  color: #4F4CD8;
109
108
  white-space: nowrap;
110
109
  overflow: hidden;
111
110
  text-overflow: ellipsis;
111
+ align-self: center;
112
112
  }
113
113
 
114
114
  /* Stats content */
@@ -139,8 +139,8 @@
139
139
  font-family: 'Lora', serif;
140
140
  font-style: normal;
141
141
  font-weight: 700;
142
- font-size: clamp(60px, 10vh, 80px);
143
- line-height: 1;
142
+ font-size: clamp(60px, 10%, 80px);
143
+ /* line-height: 1; */
144
144
  text-align: center;
145
145
  color: #4F4CD8;
146
146
  margin: 0;
@@ -148,7 +148,7 @@
148
148
 
149
149
  /* Secondary number styling - like repeat buyers in Slide5 */
150
150
  .slide6-customer__number--secondary {
151
- font-size: clamp(50px, 8vh, 70px);
151
+ font-size: clamp(50px, 8%, 70px);
152
152
  color: #FFFFFF;
153
153
  -webkit-text-stroke: 1.5px #4F4CD8;
154
154
  paint-order: stroke fill;
@@ -160,7 +160,7 @@
160
160
  font-style: normal;
161
161
  font-weight: 400;
162
162
  font-size: clamp(14px, 4.1vw, 16px);
163
- line-height: 1.5;
163
+ /* line-height: 1.5; */
164
164
  text-align: center;
165
165
  color: #3734D3;
166
166
  margin: 0;
@@ -177,7 +177,7 @@
177
177
  font-style: normal;
178
178
  font-weight: 400;
179
179
  font-size: clamp(14px, 4.1vw, 16px);
180
- line-height: 1.5;
180
+ /* line-height: 1.5; */
181
181
  text-align: center;
182
182
  color: #3734D3;
183
183
  }
@@ -197,7 +197,7 @@
197
197
  .slide6-customer__globe-wrapper {
198
198
  width: 70px;
199
199
  min-width: 70px;
200
- top: 16vh;
200
+ top: 16%;
201
201
  }
202
202
 
203
203
  .slide6-customer__link-bar {
@@ -210,11 +210,11 @@
210
210
  }
211
211
 
212
212
  .slide6-customer__number {
213
- font-size: clamp(50px, 9dvh, 70px);
213
+ font-size: clamp(50px, 10%, 70px);
214
214
  }
215
215
 
216
216
  .slide6-customer__number--secondary {
217
- font-size: clamp(42px, 7dvh, 60px);
217
+ font-size: clamp(42px, 8%, 60px);
218
218
  }
219
219
  }
220
220
 
@@ -233,17 +233,18 @@
233
233
  .slide6-customer__globe-wrapper {
234
234
  width: 60px;
235
235
  min-width: 60px;
236
- top: 14vh;
236
+ top: 14%;
237
237
  }
238
238
 
239
239
  .slide6-customer__link-bar {
240
240
  height: 32px;
241
- padding: 6px;
241
+ /* padding: 6px; */
242
242
  top: 220px;
243
243
  }
244
244
 
245
245
  .slide6-customer__link-text {
246
246
  font-size: 11px;
247
+ line-height: 32px; /* Match link-bar height */
247
248
  }
248
249
 
249
250
  .slide6-customer__content {
@@ -256,11 +257,11 @@
256
257
  }
257
258
 
258
259
  .slide6-customer__number {
259
- font-size: clamp(44px, 8dvh, 60px);
260
+ font-size: clamp(44px, 9%, 60px);
260
261
  }
261
262
 
262
263
  .slide6-customer__number--secondary {
263
- font-size: clamp(36px, 6dvh, 52px);
264
+ font-size: clamp(36px, 7%, 52px);
264
265
  }
265
266
 
266
267
  .slide6-customer__label {
@@ -288,17 +289,18 @@
288
289
  .slide6-customer__globe-wrapper {
289
290
  width: 50px;
290
291
  min-width: 50px;
291
- top: 12vh;
292
+ top: 12%;
292
293
  }
293
294
 
294
295
  .slide6-customer__link-bar {
295
296
  height: 28px;
296
- padding: 4px 6px;
297
+ /* padding: 4px 6px; */
297
298
  top: 180px;
298
299
  }
299
300
 
300
301
  .slide6-customer__link-text {
301
302
  font-size: 10px;
303
+ line-height: 28px; /* Match link-bar height */
302
304
  }
303
305
 
304
306
  .slide6-customer__search-icon {
@@ -316,11 +318,11 @@
316
318
  }
317
319
 
318
320
  .slide6-customer__number {
319
- font-size: clamp(38px, 7dvh, 52px);
321
+ font-size: clamp(38px, 8%, 52px);
320
322
  }
321
323
 
322
324
  .slide6-customer__number--secondary {
323
- font-size: clamp(30px, 5dvh, 44px);
325
+ font-size: clamp(30px, 6%, 44px);
324
326
  }
325
327
 
326
328
  .slide6-customer__label {
@@ -48,7 +48,7 @@
48
48
  font-family: 'Lora', serif;
49
49
  font-size: clamp(18px, 6.15vw, 24px);
50
50
  font-weight: 700;
51
- line-height: 1.3;
51
+ /* line-height: 1.3; */
52
52
  background: var(--bg-gradient);
53
53
  -webkit-background-clip: text;
54
54
  -webkit-text-fill-color: transparent;
@@ -89,7 +89,7 @@
89
89
  .slide7-products__text {
90
90
  display: flex;
91
91
  flex-direction: column;
92
- gap: 0.83%;
92
+ /* gap: 0.83%; */
93
93
  }
94
94
 
95
95
  .slide7-products__title,
@@ -106,7 +106,7 @@
106
106
  .slide7-products__title {
107
107
  font-size: clamp(16px, 5.13vw, 20px);
108
108
  font-weight: 700;
109
- line-height: 1.3;
109
+ /* line-height: 1.3; */
110
110
  display: -webkit-box;
111
111
  -webkit-box-orient: vertical;
112
112
  -webkit-line-clamp: 2;
@@ -6,6 +6,7 @@ export interface ScreenshotOptions {
6
6
  /**
7
7
  * Pre-captures a screenshot of the slide and caches it.
8
8
  * Call this when a slide becomes active so the image is ready for instant sharing.
9
+ * Uses fixed 1080x1920 dimensions for consistent output across all devices.
9
10
  */
10
11
  export declare function preCaptureSlide(containerRef: HTMLElement | null, options: ScreenshotOptions): Promise<void>;
11
12
  /**
@@ -1 +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"}
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;AA4ED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,WAAW,GAAG,IAAI,EAChC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CA+Cf;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,CA8Gf"}
@@ -1,6 +1,11 @@
1
1
  import html2canvas from 'html2canvas';
2
2
  // Cache for pre-captured screenshots
3
3
  const screenshotCache = new Map();
4
+ // Fixed screenshot dimensions (9:16 aspect ratio)
5
+ // Base size: 390x692, with scale 3 = 1170x2076 (close to Instagram Story standard)
6
+ const SCREENSHOT_WIDTH = 390;
7
+ const SCREENSHOT_HEIGHT = 692;
8
+ const SCREENSHOT_SCALE = 3; // Output: 1170x2076
4
9
  /**
5
10
  * Detects if the device is mobile
6
11
  */
@@ -8,9 +13,54 @@ function isMobileDevice() {
8
13
  return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||
9
14
  (navigator.maxTouchPoints > 0 && window.innerWidth < 768);
10
15
  }
16
+ /**
17
+ * Creates a fixed-size off-screen container with cloned content for consistent screenshots.
18
+ * This ensures all screenshots are 1080x1920 regardless of user's screen size.
19
+ */
20
+ function createFixedSizeContainer(storyContainer) {
21
+ // Create off-screen container
22
+ const captureContainer = document.createElement('div');
23
+ captureContainer.className = 'screenshot-capture-container';
24
+ // Clone the story container
25
+ const clonedStory = storyContainer.cloneNode(true);
26
+ clonedStory.classList.add('screenshot-mode');
27
+ // Remove buttons and progress bar from clone
28
+ const elementsToRemove = clonedStory.querySelectorAll('.recap-story__sound-btn, .recap-story__share-btn, .recap-story__progress-wrap');
29
+ elementsToRemove.forEach(el => el.remove());
30
+ captureContainer.appendChild(clonedStory);
31
+ document.body.appendChild(captureContainer);
32
+ return captureContainer;
33
+ }
34
+ /**
35
+ * Captures a screenshot from the fixed-size container
36
+ */
37
+ async function captureFixedSizeScreenshot(captureContainer) {
38
+ const clonedStory = captureContainer.querySelector('.recap-story');
39
+ const canvas = await html2canvas(clonedStory, {
40
+ scale: SCREENSHOT_SCALE,
41
+ useCORS: true,
42
+ allowTaint: true,
43
+ backgroundColor: '#FCFCFC',
44
+ logging: false,
45
+ width: SCREENSHOT_WIDTH,
46
+ height: SCREENSHOT_HEIGHT,
47
+ windowWidth: SCREENSHOT_WIDTH,
48
+ windowHeight: SCREENSHOT_HEIGHT,
49
+ });
50
+ const blob = await new Promise((resolve, reject) => {
51
+ canvas.toBlob((b) => {
52
+ if (b)
53
+ resolve(b);
54
+ else
55
+ reject(new Error('Failed to create blob'));
56
+ }, 'image/png', 1.0);
57
+ });
58
+ return blob;
59
+ }
11
60
  /**
12
61
  * Pre-captures a screenshot of the slide and caches it.
13
62
  * Call this when a slide becomes active so the image is ready for instant sharing.
63
+ * Uses fixed 1080x1920 dimensions for consistent output across all devices.
14
64
  */
15
65
  export async function preCaptureSlide(containerRef, options) {
16
66
  if (!containerRef)
@@ -19,63 +69,46 @@ export async function preCaptureSlide(containerRef, options) {
19
69
  const cacheKey = `${businessName}-${year}-${slideId}`;
20
70
  // Skip if already cached
21
71
  if (screenshotCache.has(cacheKey)) {
22
- console.log('[Screenshot] Using cached screenshot for:', cacheKey);
72
+ // console.log('[Screenshot] Using cached screenshot for:', cacheKey);
23
73
  return;
24
74
  }
25
75
  const storyContainer = containerRef.closest('.recap-story');
26
76
  if (!storyContainer)
27
77
  return;
78
+ let captureContainer = null;
28
79
  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';
80
+ // console.log('[Screenshot] Pre-capturing slide at fixed 1080x1920:', slideId);
81
+ // Create fixed-size off-screen container with cloned content
82
+ captureContainer = createFixedSizeContainer(storyContainer);
83
+ // Small delay (~1 frame at 60fps) so the browser can complete style recalculation
84
+ // and layout for the cloned DOM elements before capturing the screenshot.
85
+ await new Promise(resolve => setTimeout(resolve, 50));
86
+ // Capture from the fixed-size container
87
+ const blob = await captureFixedSizeScreenshot(captureContainer);
61
88
  const fileName = `${businessName.replace(/\s+/g, '-')}-recap-${year}-${slideId}.png`;
62
89
  const file = new File([blob], fileName, {
63
- type: mimeType,
90
+ type: 'image/png',
64
91
  lastModified: Date.now()
65
92
  });
66
93
  screenshotCache.set(cacheKey, file);
67
- console.log('[Screenshot] Pre-capture complete:', cacheKey, file.size, 'bytes');
94
+ // console.log('[Screenshot] Pre-capture complete:', cacheKey, file.size, 'bytes', '(1080x1920)');
68
95
  }
69
96
  catch (error) {
70
97
  console.error('[Screenshot] Pre-capture failed:', error);
71
98
  }
99
+ finally {
100
+ // Clean up off-screen container (skip in debug mode)
101
+ if (captureContainer && captureContainer.parentNode) {
102
+ captureContainer.parentNode.removeChild(captureContainer);
103
+ }
104
+ }
72
105
  }
73
106
  /**
74
107
  * Clears the screenshot cache (call when leaving recap)
75
108
  */
76
109
  export function clearScreenshotCache() {
77
110
  screenshotCache.clear();
78
- console.log('[Screenshot] Cache cleared');
111
+ // console.log('[Screenshot] Cache cleared');
79
112
  }
80
113
  /**
81
114
  * Check if a screenshot is cached for a specific slide
@@ -100,19 +133,19 @@ export async function captureAndShareSlide(containerRef, options) {
100
133
  const { slideId, businessName, year } = options;
101
134
  const cacheKey = `${businessName}-${year}-${slideId}`;
102
135
  const isMobile = isMobileDevice();
103
- console.log('[Screenshot] Device type:', isMobile ? 'mobile' : 'desktop');
104
- console.log('[Screenshot] Cache key:', cacheKey);
136
+ // console.log('[Screenshot] Device type:', isMobile ? 'mobile' : 'desktop');
137
+ // console.log('[Screenshot] Cache key:', cacheKey);
105
138
  // Check for cached screenshot (enables instant sharing on mobile)
106
139
  const cachedFile = screenshotCache.get(cacheKey);
107
- console.log('[Screenshot] Cache available:', !!cachedFile);
140
+ // console.log('[Screenshot] Cache available:', !!cachedFile);
108
141
  // MOBILE: Must use cached file for instant share (user gesture chain)
109
142
  if (isMobile) {
110
143
  if (cachedFile) {
111
- console.log('[Screenshot] Using cached file for instant share');
144
+ // console.log('[Screenshot] Using cached file for instant share');
112
145
  // CRITICAL: Call navigator.share() directly without any await before it
113
146
  // to maintain the user gesture chain on mobile browsers (especially Edge)
114
147
  const canShareFiles = navigator.canShare && navigator.canShare({ files: [cachedFile] });
115
- console.log('[Screenshot] Can share files:', canShareFiles);
148
+ // console.log('[Screenshot] Can share files:', canShareFiles);
116
149
  if (canShareFiles) {
117
150
  // Call share synchronously - no try/catch wrapper that could break gesture chain
118
151
  navigator.share({
@@ -120,7 +153,7 @@ export async function captureAndShareSlide(containerRef, options) {
120
153
  title: 'My Huxxle Recap',
121
154
  text: `Check out ${businessName}'s Wrapped ${year} highlights! 🎉`
122
155
  }).then(() => {
123
- console.log('[Screenshot] Share successful!');
156
+ // console.log('[Screenshot] Share successful!');
124
157
  }).catch((err) => {
125
158
  console.error('[Screenshot] Share failed:', err);
126
159
  // If user cancelled (AbortError), don't download
@@ -133,7 +166,7 @@ export async function captureAndShareSlide(containerRef, options) {
133
166
  return;
134
167
  }
135
168
  // Mobile browser doesn't support file sharing - download instead
136
- console.log('[Screenshot] File sharing not supported, downloading...');
169
+ // console.log('[Screenshot] File sharing not supported, downloading...');
137
170
  const blob = new Blob([cachedFile], { type: cachedFile.type });
138
171
  downloadImage(blob, cachedFile.name);
139
172
  return;
@@ -143,57 +176,32 @@ export async function captureAndShareSlide(containerRef, options) {
143
176
  console.warn('[Screenshot] No cache on mobile - falling back to capture + download');
144
177
  // Continue to fresh capture below, but it will download instead of share
145
178
  }
146
- // DESKTOP or MOBILE-FALLBACK: Capture fresh screenshot
179
+ // DESKTOP or MOBILE-FALLBACK: Capture fresh screenshot with fixed dimensions
147
180
  const storyContainer = containerRef.closest('.recap-story');
148
181
  if (!storyContainer) {
149
182
  console.error('[Screenshot] Could not find .recap-story container');
150
183
  return;
151
184
  }
185
+ let captureContainer = null;
152
186
  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
+ // console.log('[Screenshot] Starting fixed-size capture (1080x1920)...');
188
+ // Create fixed-size off-screen container with cloned content
189
+ captureContainer = createFixedSizeContainer(storyContainer);
190
+ // Small delay to allow styles to apply to cloned content
191
+ await new Promise(resolve => setTimeout(resolve, 50));
192
+ // Capture from the fixed-size container
193
+ const blob = await captureFixedSizeScreenshot(captureContainer);
194
+ // console.log('[Screenshot] Blob created:', blob.size, 'bytes', '(1080x1920)');
187
195
  const fileName = `${businessName.replace(/\s+/g, '-')}-recap-${year}-${slideId}.png`;
188
196
  // DESKTOP: Always download
189
197
  if (!isMobile) {
190
- console.log('[Screenshot] Desktop - downloading...');
198
+ // console.log('[Screenshot] Desktop - downloading...');
191
199
  downloadImage(blob, fileName);
192
200
  return;
193
201
  }
194
202
  // MOBILE (no cache): Try to share, likely will fail due to user gesture timing
195
203
  const file = new File([blob], fileName, {
196
- type: mimeType,
204
+ type: 'image/png',
197
205
  lastModified: Date.now()
198
206
  });
199
207
  // Cache for next time
@@ -204,14 +212,17 @@ export async function captureAndShareSlide(containerRef, options) {
204
212
  console.error('[Screenshot] Capture failed:', error);
205
213
  }
206
214
  finally {
207
- storyContainer.classList.remove('screenshot-mode');
215
+ // Clean up off-screen container
216
+ if (captureContainer && captureContainer.parentNode) {
217
+ captureContainer.parentNode.removeChild(captureContainer);
218
+ }
208
219
  }
209
220
  }
210
221
  /**
211
222
  * Shares a file using Web Share API with fallbacks
212
223
  */
213
224
  async function shareFile(file, businessName, year) {
214
- console.log('[Screenshot] File to share:', file.name, file.type, file.size, 'bytes');
225
+ // console.log('[Screenshot] File to share:', file.name, file.type, file.size, 'bytes');
215
226
  // Validate file size (WhatsApp limit: 5MB for images)
216
227
  const maxSize = 5 * 1024 * 1024;
217
228
  if (file.size > maxSize) {
@@ -220,17 +231,17 @@ async function shareFile(file, businessName, year) {
220
231
  }
221
232
  // Check if Web Share API with files is supported
222
233
  const canShareFiles = navigator.canShare && navigator.canShare({ files: [file] });
223
- console.log('[Screenshot] Can share files:', canShareFiles);
234
+ // console.log('[Screenshot] Can share files:', canShareFiles);
224
235
  // Try sharing with file
225
236
  if (canShareFiles) {
226
- console.log('[Screenshot] Sharing file...');
237
+ // console.log('[Screenshot] Sharing file...');
227
238
  try {
228
239
  await navigator.share({
229
240
  files: [file],
230
241
  title: 'My Huxxle Recap',
231
242
  text: `Check out ${businessName}'s Wrapped ${year} highlights! 🎉`
232
243
  });
233
- console.log('[Screenshot] Share successful!');
244
+ // console.log('[Screenshot] Share successful!');
234
245
  return;
235
246
  }
236
247
  catch (shareError) {
@@ -239,7 +250,7 @@ async function shareFile(file, businessName, year) {
239
250
  }
240
251
  // Fallback: share URL only
241
252
  if (navigator.share) {
242
- console.log('[Screenshot] Sharing URL fallback...');
253
+ // console.log('[Screenshot] Sharing URL fallback...');
243
254
  try {
244
255
  await navigator.share({
245
256
  title: 'My Huxxle Recap',
@@ -253,7 +264,7 @@ async function shareFile(file, businessName, year) {
253
264
  }
254
265
  }
255
266
  // Final fallback: download
256
- console.log('[Screenshot] Download fallback...');
267
+ // console.log('[Screenshot] Download fallback...');
257
268
  const blob = new Blob([await file.arrayBuffer()], { type: file.type });
258
269
  downloadImage(blob, file.name);
259
270
  }
@@ -261,7 +272,7 @@ async function shareFile(file, businessName, year) {
261
272
  * Downloads an image blob
262
273
  */
263
274
  function downloadImage(blob, fileName) {
264
- console.log('[Screenshot] Downloading:', fileName);
275
+ // console.log('[Screenshot] Downloading:', fileName);
265
276
  const url = URL.createObjectURL(blob);
266
277
  const a = document.createElement('a');
267
278
  a.href = url;
@@ -270,5 +281,5 @@ function downloadImage(blob, fileName) {
270
281
  a.click();
271
282
  document.body.removeChild(a);
272
283
  URL.revokeObjectURL(url);
273
- console.log('[Screenshot] Download complete');
284
+ // console.log('[Screenshot] Download complete');
274
285
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katajere/recap",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "Vendor Year in Review Experience - Recap your business metrics for 2025",
5
5
  "private": false,
6
6
  "publishConfig": {
package/src/App.tsx CHANGED
@@ -23,8 +23,6 @@ function App() {
23
23
 
24
24
  // Handle OTP submission
25
25
  const handleOtpSubmit = (otp: string) => {
26
- // In production, verify OTP with backend here
27
- console.log('OTP submitted:', otp);
28
26
  setAuthStep(AUTH_STEPS.RECAP);
29
27
  };
30
28