@katajere/recap 1.0.14 → 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.
Files changed (96) hide show
  1. package/dist/App.css +22 -2
  2. package/dist/LoginScreen.css +22 -21
  3. package/dist/OtpScreen.css +20 -17
  4. package/dist/RecapStory.css +148 -0
  5. package/dist/RecapStory.d.ts.map +1 -1
  6. package/dist/RecapStory.js +61 -28
  7. package/dist/StoryProgress.css +3 -3
  8. package/dist/assets/huxxle-login-blue-logo.svg +14 -0
  9. package/dist/assets/noisy-background.png +0 -0
  10. package/dist/assets/noisy-background.svg +23 -0
  11. package/dist/assets/search-icon.svg +4 -0
  12. package/dist/assets/share-button.svg +5 -0
  13. package/dist/assets/web-icon.png +0 -0
  14. package/dist/assets/web-icon.svg +14 -0
  15. package/dist/components/Header.css +12 -1
  16. package/dist/components/Header.js +2 -2
  17. package/dist/data/mock.d.ts.map +1 -1
  18. package/dist/data/mock.js +19 -7
  19. package/dist/index.d.ts +0 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +0 -1
  22. package/dist/slides/Slide10Final.css +73 -35
  23. package/dist/slides/Slide1Intro.css +204 -56
  24. package/dist/slides/Slide1Intro.d.ts +2 -1
  25. package/dist/slides/Slide1Intro.d.ts.map +1 -1
  26. package/dist/slides/Slide1Intro.js +41 -47
  27. package/dist/slides/Slide2Days.css +121 -34
  28. package/dist/slides/Slide2Days.d.ts +2 -1
  29. package/dist/slides/Slide2Days.d.ts.map +1 -1
  30. package/dist/slides/Slide2Days.js +45 -4
  31. package/dist/slides/Slide3Revenue.css +80 -38
  32. package/dist/slides/Slide3Revenue.d.ts.map +1 -1
  33. package/dist/slides/Slide3Revenue.js +31 -3
  34. package/dist/slides/Slide4Orders.css +93 -34
  35. package/dist/slides/Slide4Orders.d.ts +2 -1
  36. package/dist/slides/Slide4Orders.d.ts.map +1 -1
  37. package/dist/slides/Slide4Orders.js +45 -3
  38. package/dist/slides/Slide5Buyers.css +124 -67
  39. package/dist/slides/Slide5Buyers.d.ts +2 -1
  40. package/dist/slides/Slide5Buyers.d.ts.map +1 -1
  41. package/dist/slides/Slide5Buyers.js +43 -3
  42. package/dist/slides/Slide6Customer.css +294 -52
  43. package/dist/slides/Slide6Customer.d.ts +6 -3
  44. package/dist/slides/Slide6Customer.d.ts.map +1 -1
  45. package/dist/slides/Slide6Customer.js +25 -4
  46. package/dist/slides/Slide7Products.css +8 -7
  47. package/dist/slides/Slide7Products.js +3 -3
  48. package/dist/slides/Slide8Months.css +6 -6
  49. package/dist/slides/Slide9Year.css +4 -2
  50. package/dist/slides/Slide9Year.d.ts +2 -1
  51. package/dist/slides/Slide9Year.d.ts.map +1 -1
  52. package/dist/slides/Slide9Year.js +23 -2
  53. package/dist/types.d.ts +5 -0
  54. package/dist/types.d.ts.map +1 -1
  55. package/dist/utils/slideScreenshot.d.ts +27 -0
  56. package/dist/utils/slideScreenshot.d.ts.map +1 -0
  57. package/dist/utils/slideScreenshot.js +274 -0
  58. package/package.json +2 -1
  59. package/src/App.css +22 -2
  60. package/src/LoginScreen.css +22 -21
  61. package/src/LoginScreen.tsx +1 -1
  62. package/src/OtpScreen.css +20 -17
  63. package/src/OtpScreen.tsx +1 -1
  64. package/src/RecapStory.css +148 -0
  65. package/src/RecapStory.tsx +131 -57
  66. package/src/StoryProgress.css +3 -3
  67. package/src/components/Header.css +12 -1
  68. package/src/components/Header.tsx +2 -2
  69. package/src/data/mock.ts +19 -7
  70. package/src/index.ts +0 -1
  71. package/src/slides/Slide10Final.css +73 -35
  72. package/src/slides/Slide1Intro.css +204 -56
  73. package/src/slides/Slide1Intro.tsx +89 -81
  74. package/src/slides/Slide2Days.css +121 -34
  75. package/src/slides/Slide2Days.tsx +67 -19
  76. package/src/slides/Slide3Revenue.css +80 -38
  77. package/src/slides/Slide3Revenue.tsx +43 -6
  78. package/src/slides/Slide4Orders.css +93 -34
  79. package/src/slides/Slide4Orders.tsx +71 -10
  80. package/src/slides/Slide5Buyers.css +124 -67
  81. package/src/slides/Slide5Buyers.tsx +97 -38
  82. package/src/slides/Slide6Customer.css +294 -52
  83. package/src/slides/Slide6Customer.tsx +68 -10
  84. package/src/slides/Slide7Products.css +8 -7
  85. package/src/slides/Slide7Products.tsx +3 -3
  86. package/src/slides/Slide8Months.css +6 -6
  87. package/src/slides/Slide9Year.css +4 -2
  88. package/src/slides/Slide9Year.tsx +35 -7
  89. package/src/types.ts +5 -0
  90. package/src/utils/slideScreenshot.ts +324 -0
  91. package/dist/FloatingFrames.css +0 -55
  92. package/dist/FloatingFrames.d.ts +0 -11
  93. package/dist/FloatingFrames.d.ts.map +0 -1
  94. package/dist/FloatingFrames.js +0 -12
  95. package/src/FloatingFrames.css +0 -55
  96. package/src/FloatingFrames.tsx +0 -27
package/dist/App.css CHANGED
@@ -4,6 +4,26 @@
4
4
  --frame-ar-num: 9;
5
5
  --frame-ar-den: 16;
6
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
  * {
@@ -62,7 +82,8 @@ body {
62
82
  height: min(100dvh, calc(100vw * var(--frame-ar-den) / var(--frame-ar-num)));
63
83
  max-width: 1080px;
64
84
  max-height: 1920px;
65
- background: linear-gradient(180deg, #3F3DAD 0%, #CC6240 100%);
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);
@@ -90,7 +111,6 @@ body {
90
111
  /* Mobile - remove border radius and shadow */
91
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
 
@@ -3,7 +3,7 @@
3
3
  position: relative;
4
4
  width: 100%;
5
5
  height: 100%;
6
- /* background: linear-gradient(180deg, #3F3DAD 0%, #CC6240 100%); */
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
- background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
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.2;
58
- background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
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: #FCFCFC;
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: 1.42% 4.1%;
100
+ padding: 12px 16px;
100
101
  width: 100%;
101
- height: 5.69%;
102
+ height: 48px;
102
103
  min-height: 48px;
103
104
  background: transparent;
104
- border: 1px solid #FCFCFC;
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: #FCFCFC;
111
+ color: var(--text-primary);
111
112
  outline: none;
112
113
  }
113
114
 
114
115
  .form-input::placeholder {
115
- color: #FCFCFC;
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: 1.42% 4.1%;
125
+ padding: 12px 16px;
125
126
  width: 100%;
126
- height: 5.69%;
127
+ height: 48px;
127
128
  min-height: 48px;
128
- background: #FCFCFC;
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: #4F4CD8;
136
+ color: var(--text-white);
136
137
  cursor: pointer;
137
138
  transition: opacity 0.2s;
138
139
  }
@@ -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
- background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
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.2;
57
- background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
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: 1.42% 4.1%;
84
+ padding: 12px 16px;
82
85
  flex: 1;
83
86
  height: 100%;
84
- border: 1px solid #FCFCFC;
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: #FCFCFC;
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: #FCFCFC;
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: 1.42% 4.1%;
114
+ padding: 12px 16px;
112
115
  width: 100%;
113
- height: 5.69%;
116
+ height: 48px;
114
117
  min-height: 48px;
115
- background: #FCFCFC;
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: #4F4CD8;
125
+ color: var(--text-white);
123
126
  cursor: pointer;
124
127
  transition: opacity 0.2s;
125
128
  }
@@ -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
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"RecapStory.d.ts","sourceRoot":"","sources":["../src/RecapStory.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAuB,SAAS,EAAE,MAAM,SAAS,CAAC;AAKzD,OAAO,kBAAkB,CAAC;AAE1B,UAAU,eAAe;IACvB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE,eAAe,2CAgTjD;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"RecapStory.d.ts","sourceRoot":"","sources":["../src/RecapStory.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAuB,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzD,OAAO,kBAAkB,CAAC;AAE1B,UAAU,eAAe;IACvB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE,eAAe,2CA2XjD;AAED,eAAe,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React, { useState, useRef } from "react";
3
3
  import { AnimatePresence, motion } from "framer-motion";
4
4
  import StoryProgress from "./StoryProgress";
@@ -14,11 +14,10 @@ import Slide8Months from "./slides/Slide8Months";
14
14
  import Slide9Year from "./slides/Slide9Year";
15
15
  import Slide10Final from "./slides/Slide10Final";
16
16
  import { slideVariants } from "./utils";
17
+ import { captureAndShareSlide, preCaptureSlide, clearScreenshotCache } from "./utils/slideScreenshot";
17
18
  import { slideDurations as defaultDurations } from "./data/mock";
18
19
  import { BUSINESS_CATEGORIES } from "./types";
19
20
  import { useBackgroundMusic } from "./hooks/useBackgroundMusic";
20
- import soundOnIcon from "./assets/sound-on.svg";
21
- import soundOffIcon from "./assets/sound-off.svg";
22
21
  import recapMusic from "./assets/recap-music.mp3";
23
22
  import "./RecapStory.css";
24
23
  /**
@@ -27,17 +26,19 @@ import "./RecapStory.css";
27
26
  function RecapStory({ recapData }) {
28
27
  const [activeIndex, setActiveIndex] = useState(0);
29
28
  const durations = recapData.slideDurations || defaultDurations;
30
- const [introDuration, setIntroDuration] = useState(durations.intro);
31
- const [isIntroDurationReady, setIsIntroDurationReady] = useState(false);
32
29
  const [isPaused, setIsPaused] = useState(false);
30
+ const [isShareVisible, setIsShareVisible] = useState(false);
33
31
  const holdTimerRef = useRef(null);
34
32
  const isHoldingRef = useRef(false);
33
+ const slidesContainerRef = useRef(null);
35
34
  // Cleanup on unmount to prevent memory leaks
36
35
  React.useEffect(() => {
37
36
  return () => {
38
37
  if (holdTimerRef.current) {
39
38
  clearTimeout(holdTimerRef.current);
40
39
  }
40
+ // Clear screenshot cache on unmount
41
+ clearScreenshotCache();
41
42
  };
42
43
  }, []);
43
44
  const { isMuted, isPlaying, toggleMute, play, stop } = useBackgroundMusic({
@@ -46,21 +47,10 @@ function RecapStory({ recapData }) {
46
47
  autoPlay: true,
47
48
  loop: false,
48
49
  });
49
- // Handle intro duration updates
50
- const handleIntroDurationCalculated = (duration) => {
51
- setIntroDuration(duration);
52
- setIsIntroDurationReady(true);
53
- };
54
- // Reset ready state when returning to intro slide
55
- React.useEffect(() => {
56
- if (activeIndex === 0) {
57
- setIsIntroDurationReady(false);
58
- }
59
- }, [activeIndex]);
60
50
  const isNewUser = recapData.businessCategory === BUSINESS_CATEGORIES.NEW_USER;
61
51
  // Define slides with their durations (new-user only sees the intro)
62
52
  const fullSlideSet = [
63
- { id: "intro", duration: introDuration },
53
+ { id: "intro", duration: durations.intro },
64
54
  { id: "days", duration: durations.days },
65
55
  { id: "revenue", duration: durations.revenue },
66
56
  { id: "orders", duration: durations.orders },
@@ -72,20 +62,56 @@ function RecapStory({ recapData }) {
72
62
  { id: "final", duration: durations.final },
73
63
  ];
74
64
  const slides = isNewUser
75
- ? [{ id: "intro", duration: introDuration }]
65
+ ? [{ id: "intro", duration: durations.intro }]
76
66
  : fullSlideSet;
77
67
  const currentSlide = slides[activeIndex];
78
68
  const isFinalSlide = currentSlide.id === "final";
69
+ // Pre-capture screenshot and show share button when ready
70
+ React.useEffect(() => {
71
+ // Hide share button immediately on slide change
72
+ setIsShareVisible(false);
73
+ if (isFinalSlide || !slidesContainerRef.current)
74
+ return;
75
+ let isMounted = true;
76
+ // Wait for animations to complete, then pre-capture
77
+ const timer = setTimeout(async () => {
78
+ if (!isMounted || !slidesContainerRef.current)
79
+ return;
80
+ try {
81
+ // Pre-capture the screenshot
82
+ await preCaptureSlide(slidesContainerRef.current, {
83
+ slideId: currentSlide.id,
84
+ businessName: recapData.businessName,
85
+ year: recapData.year ?? 2025,
86
+ });
87
+ // Only show share button AFTER pre-capture is complete
88
+ if (isMounted) {
89
+ setIsShareVisible(true);
90
+ }
91
+ }
92
+ catch (error) {
93
+ console.error('[RecapStory] Pre-capture failed:', error);
94
+ // Still show share button even if pre-capture fails (will fall back to download)
95
+ if (isMounted) {
96
+ setIsShareVisible(true);
97
+ }
98
+ }
99
+ }, 2500); // Wait 2.5s for all animations to complete
100
+ return () => {
101
+ isMounted = false;
102
+ clearTimeout(timer);
103
+ };
104
+ }, [activeIndex, currentSlide.id, recapData.businessName, recapData.year, isFinalSlide]);
79
105
  // Ensure music plays only on slides 1-9 and stops immediately on the final slide
80
106
  React.useEffect(() => {
81
107
  if (isFinalSlide) {
82
108
  stop();
83
109
  return;
84
110
  }
85
- if (isIntroDurationReady && !isPlaying) {
111
+ if (!isPlaying) {
86
112
  play();
87
113
  }
88
- }, [isFinalSlide, isIntroDurationReady, isPlaying, play, stop]);
114
+ }, [isFinalSlide, isPlaying, play, stop]);
89
115
  // Stop music when reaching the final slide (safety net)
90
116
  React.useEffect(() => {
91
117
  if (isFinalSlide) {
@@ -103,7 +129,6 @@ function RecapStory({ recapData }) {
103
129
  };
104
130
  const handleReplay = () => {
105
131
  setActiveIndex(0);
106
- setIsIntroDurationReady(false);
107
132
  setIsPaused(false);
108
133
  };
109
134
  // Jump to specific slide when bar is clicked
@@ -177,29 +202,37 @@ function RecapStory({ recapData }) {
177
202
  const renderSlide = () => {
178
203
  switch (currentSlide.id) {
179
204
  case "intro":
180
- return (_jsx(Slide1Intro, { businessName: recapData.businessName, businessCategory: recapData.businessCategory, introHeadline: recapData.introHeadline, introSubtitle: recapData.introSubtitle, onDurationCalculated: handleIntroDurationCalculated }));
205
+ return (_jsx(Slide1Intro, { businessName: recapData.businessName, businessCategory: recapData.businessCategory, introHeadline: recapData.introHeadline, introSubtitle: recapData.introSubtitle, frameImages: recapData.productImages }));
181
206
  case "days":
182
- return _jsx(Slide2Days, { days: recapData.days, streak: recapData.streak });
207
+ return (_jsx(Slide2Days, { days: recapData.days, streak: recapData.streak, frameImages: recapData.productImages }));
183
208
  case "revenue":
184
209
  return (_jsx(Slide3Revenue, { revenue: recapData.revenue, currency: recapData.currency, businessCategory: recapData.businessCategory }));
185
210
  case "orders":
186
- return _jsx(Slide4Orders, { orders: recapData.orders });
211
+ return (_jsx(Slide4Orders, { orders: recapData.orders, frameImages: recapData.productImages }));
187
212
  case "buyers":
188
- return (_jsx(Slide5Buyers, { firstTimeBuyers: recapData.firstTimeBuyers, repeatBuyers: recapData.repeatBuyers }));
213
+ return (_jsx(Slide5Buyers, { firstTimeBuyers: recapData.firstTimeBuyers, repeatBuyers: recapData.repeatBuyers, frameImages: recapData.productImages }));
189
214
  case "customer":
190
- return _jsx(Slide6Customer, { customerName: recapData.topCustomerName });
215
+ return (_jsx(Slide6Customer, { websiteLink: recapData.websiteLink ?? "", websiteVisits: recapData.websiteVisits ?? 0, mostViewedProduct: recapData.mostViewedProduct ?? "", mostViewedProductCount: recapData.mostViewedProductCount ?? 0 }));
191
216
  case "products":
192
217
  return _jsx(Slide7Products, { products: recapData.topProducts });
193
218
  case "months":
194
219
  return _jsx(Slide8Months, { busiestMonth: recapData.busiestMonth });
195
220
  case "year":
196
- return (_jsx(Slide9Year, { businessCategory: recapData.businessCategory, year: recapData.year }));
221
+ return (_jsx(Slide9Year, { businessCategory: recapData.businessCategory, year: recapData.year, frameImages: recapData.productImages }));
197
222
  case "final":
198
223
  return (_jsx(Slide10Final, { videoUrl: recapData.videoUrl, downloadUrl: recapData.downloadUrl, year: recapData.year, onReplay: handleReplay }));
199
224
  default:
200
225
  return null;
201
226
  }
202
227
  };
203
- return (_jsxs("div", { className: "recap-story", children: [_jsxs("div", { className: "recap-story__top-group", children: [_jsx("div", { className: "recap-story__header-wrapper", children: _jsx(Header, { showRecapBadge: true, badgeVariant: isNewUser ? "new-user" : "default", year: recapData.year }) }), _jsxs("div", { className: "recap-story__progress-wrap", children: [_jsx("div", { className: "recap-story__progress", children: (activeIndex !== 0 || isIntroDurationReady) && (_jsx(StoryProgress, { total: slides.length, active: activeIndex, duration: currentSlide.duration, onComplete: handleProgressComplete, onBarClick: handleBarClick, hideBorder: isFinalSlide, isPaused: isPaused })) }), !isFinalSlide && recapData.isVideo !== true && (_jsx("button", { type: "button", className: "recap-story__sound-toggle", onClick: toggleMute, "aria-label": isMuted ? "Unmute sound" : "Mute sound", children: _jsx("img", { src: isMuted ? soundOffIcon : soundOnIcon, alt: isMuted ? "Unmute sound" : "Mute sound", className: "recap-story__sound-icon", draggable: false }) }))] })] }), _jsx("div", { className: "recap-story__slides", onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave, onPointerCancel: handlePointerLeave, children: _jsx(AnimatePresence, { mode: "wait", children: _jsx(motion.div, { variants: slideVariants, initial: "initial", animate: "animate", exit: "exit", className: "recap-story__slide", children: renderSlide() }, currentSlide.id) }) })] }));
228
+ return (_jsxs("div", { className: "recap-story", children: [_jsxs("div", { className: "recap-story__top-group", children: [_jsx("div", { className: "recap-story__header-wrapper", children: _jsx(Header, { showRecapBadge: true, badgeVariant: isNewUser ? "new-user" : "default", year: recapData.year }) }), _jsx("div", { className: "recap-story__progress-wrap", children: _jsx("div", { className: "recap-story__progress", children: _jsx(StoryProgress, { total: slides.length, active: activeIndex, duration: currentSlide.duration, onComplete: handleProgressComplete, onBarClick: handleBarClick, hideBorder: isFinalSlide, isPaused: isPaused }) }) })] }), _jsx("div", { className: "recap-story__slides", ref: slidesContainerRef, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave, onPointerCancel: handlePointerLeave, children: _jsx(AnimatePresence, { mode: "wait", children: _jsx(motion.div, { variants: slideVariants, initial: "initial", animate: "animate", exit: "exit", className: "recap-story__slide", children: renderSlide() }, currentSlide.id) }) }), !isFinalSlide && !recapData.isVideo && (_jsxs(_Fragment, { children: [_jsx("button", { className: "recap-story__floating-btn recap-story__sound-btn", onClick: toggleMute, "aria-label": isMuted ? "Unmute" : "Mute", children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("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" }), !isMuted && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M15 6.66667C16.3834 8.30834 16.3834 11.7 15 13.3333", stroke: "#4F4CD8", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("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" })] }))] }) }), !isNewUser && (_jsxs("button", { className: `recap-story__floating-btn recap-story__share-btn ${isShareVisible ? 'recap-story__share-btn--visible' : ''}`, onClick: () => {
229
+ // Call without await - the function handles sharing internally
230
+ // This preserves the user gesture chain for mobile Web Share API
231
+ captureAndShareSlide(slidesContainerRef.current, {
232
+ slideId: currentSlide.id,
233
+ businessName: recapData.businessName,
234
+ year: recapData.year ?? new Date().getFullYear(),
235
+ });
236
+ }, "aria-label": "Share", children: [_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("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" }), _jsx("path", { d: "M10 12.4999V3.0166", stroke: "#4F4CD8", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M12.7916 4.87516L9.99998 2.0835L7.20831 4.87516", stroke: "#4F4CD8", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { className: "recap-story__share-text", children: "Share" })] }))] }))] }));
204
237
  }
205
238
  export default RecapStory;
@@ -19,7 +19,7 @@
19
19
  width: 100%;
20
20
  height: 100%;
21
21
  background: transparent;
22
- border: 0.5px solid rgba(217, 217, 217, 0.3);
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, #FFFFFF 0%, #FFCC80 100%);
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, #FFFFFF 0%, #FFCC80 100%);
44
+ background: linear-gradient(90deg, #4F4CD8 0%, #2A2872 100%);
45
45
  transform-origin: left;
46
46
  transform: scaleX(0);
47
47
  }
@@ -0,0 +1,14 @@
1
+ <svg width="106" height="32" viewBox="0 0 106 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <mask id="mask0_13959_16184" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="2" y="0" width="28" height="32">
3
+ <path d="M15.5897 0.236862C15.8436 0.0902912 16.1564 0.0902912 16.4103 0.236862L29.4461 7.76314C29.7 7.90971 29.8564 8.18058 29.8564 8.47372V23.5263C29.8564 23.8194 29.7 24.0903 29.4461 24.2369L16.4103 31.7631C16.1564 31.9097 15.8436 31.9097 15.5897 31.7631L2.55385 24.2369C2.29998 24.0903 2.14359 23.8194 2.14359 23.5263V8.47372C2.14359 8.18058 2.29998 7.90971 2.55385 7.76314L15.5897 0.236862Z" fill="#4F4CD8"/>
4
+ </mask>
5
+ <g mask="url(#mask0_13959_16184)">
6
+ <path d="M29.8466 27.6924V36.1025L16.0009 28.1025L2.15424 36.1025V27.6924L16.0009 19.6924L29.8466 27.6924ZM29.8466 17.8457V26.2568L16.0009 18.2568L2.15424 26.2568V17.8457L16.0009 9.8457L29.8466 17.8457ZM29.8466 8V16.4102L15.9999 8.41016L2.15424 16.4102V8L15.9999 0L29.8466 8ZM2.97455 8.47363V14.9883L15.5898 7.7002L15.9999 7.46289L16.4111 7.7002L29.0263 14.9883V8.47363L15.9999 0.947266L2.97455 8.47363Z" fill="#4F4CD8"/>
7
+ </g>
8
+ <path d="M45.4728 17.243H38.482V18.4984C38.482 20.9846 38.5067 23.5938 38.5559 24.7015C38.3344 24.6769 37.7928 24.6522 37.1528 24.6522C35.9713 24.6522 35.6267 24.6522 35.282 24.7015C35.3559 23.6922 35.3805 21.1815 35.3805 18.523V14.7322C35.3805 11.7046 35.3559 9.51379 35.282 8.52917C35.5774 8.5784 36.1682 8.5784 36.7097 8.5784C37.7928 8.5784 38.2359 8.5784 38.5559 8.52917C38.5067 9.34148 38.482 11.8276 38.482 14.3384V14.8307H45.4728V14.2892C45.4728 11.2615 45.4728 9.31686 45.399 8.52917C45.842 8.5784 46.3836 8.5784 46.9251 8.5784C47.762 8.5784 48.3774 8.5784 48.6728 8.52917C48.6236 9.41532 48.599 11.7292 48.599 14.7322V18.523C48.599 21.0092 48.6236 24.0369 48.6728 24.7015C48.402 24.6769 47.9344 24.6522 47.2697 24.6522C46.162 24.6522 45.7682 24.6276 45.399 24.7015C45.4482 23.7415 45.4728 20.6399 45.4728 18.4984V17.243Z" fill="#4F4CD8"/>
9
+ <path d="M62.3409 24.6769C62.0701 24.6769 61.4055 24.6522 60.8394 24.6522C59.8547 24.6522 59.6578 24.6769 59.3132 24.7015C59.2393 24.4061 59.2147 23.7907 59.1901 23.3969C58.4024 24.2584 57.2947 24.9476 55.6455 24.9476C53.7747 24.9476 51.9532 24.0369 51.9532 20.6399V18.7692C51.9532 16.3815 51.9778 13.6246 51.904 12.9353C53.0609 12.9353 53.947 12.9353 54.9809 12.763C54.9317 13.6738 54.907 16.1353 54.907 18.7692V20.0246C54.907 21.6492 55.3994 22.6338 56.9994 22.6338C57.8609 22.6338 58.6732 22.1661 59.1901 21.4769V18.8184C59.1901 16.4307 59.1655 13.5507 59.1163 12.8861C60.1994 12.9599 61.2578 12.9846 62.2424 12.8122C62.1932 13.6738 62.144 15.8892 62.144 18.4738V19.7292C62.144 22.1415 62.1932 24.1353 62.3409 24.6769Z" fill="#4F4CD8"/>
10
+ <path d="M64.023 12.8861C64.2199 12.8861 64.8107 12.9353 65.5984 12.9353C66.263 12.9353 66.9522 12.9353 67.6168 12.8861C68.4538 14.4861 69.3645 15.9384 69.783 16.6276C70.2507 15.9384 71.2599 14.3384 72.0476 12.8861C72.2692 12.9107 72.7122 12.9353 73.0815 12.9353C74.1153 12.9353 74.6568 12.9353 75.0999 12.8861C73.9922 14.3138 72.3922 16.6769 71.1615 18.3999C72.4415 20.5415 74.0907 22.9538 75.2968 24.7015C74.903 24.6769 74.0907 24.6522 73.7215 24.6522C72.8353 24.6769 72.3184 24.6769 71.7522 24.7261C71.2107 23.5692 69.7584 21.2799 69.3892 20.6153C68.7245 21.6738 67.4938 23.7661 67.0261 24.7015C66.7307 24.6769 65.9676 24.6522 65.6968 24.6522C65.0568 24.6522 64.4168 24.6522 63.9492 24.7015C65.1307 23.003 66.8045 20.6399 68.0107 18.8676C66.7799 16.8492 65.1799 14.5353 64.023 12.8861Z" fill="#4F4CD8"/>
11
+ <path d="M75.898 12.8861C76.0949 12.8861 76.6857 12.9353 77.4734 12.9353C78.138 12.9353 78.8272 12.9353 79.4918 12.8861C80.3288 14.4861 81.2395 15.9384 81.658 16.6276C82.1257 15.9384 83.1349 14.3384 83.9226 12.8861C84.1442 12.9107 84.5872 12.9353 84.9565 12.9353C85.9903 12.9353 86.5318 12.9353 86.9749 12.8861C85.8672 14.3138 84.2672 16.6769 83.0365 18.3999C84.3165 20.5415 85.9657 22.9538 87.1718 24.7015C86.778 24.6769 85.9657 24.6522 85.5965 24.6522C84.7103 24.6769 84.1934 24.6769 83.6272 24.7261C83.0857 23.5692 81.6334 21.2799 81.2642 20.6153C80.5995 21.6738 79.3688 23.7661 78.9011 24.7015C78.6057 24.6769 77.8426 24.6522 77.5718 24.6522C76.9318 24.6522 76.2918 24.6522 75.8242 24.7015C77.0057 23.003 78.6795 20.6399 79.8857 18.8676C78.6549 16.8492 77.0549 14.5353 75.898 12.8861Z" fill="#4F4CD8"/>
12
+ <path d="M88.8522 24.7015C88.9015 24.1353 88.9261 21.9199 88.9261 19.3599V13.1569C88.9261 10.2276 88.9261 7.9384 88.8522 7.19994C89.9107 7.19994 90.9445 7.19994 91.9538 7.05225C91.9045 8.03686 91.8799 9.78455 91.8799 12.6646V20.6399C91.8799 22.5107 91.9292 24.2338 91.9538 24.7015C91.683 24.6769 91.0184 24.6522 90.403 24.6522C89.6399 24.6522 89.1476 24.6769 88.8522 24.7015Z" fill="#4F4CD8"/>
13
+ <path d="M105.142 18.9661C104.33 19.0892 102.754 19.1384 100.17 19.1384H97.4618C97.5357 21.6738 99.3572 22.683 101.326 22.683C102.68 22.683 103.517 22.4369 104.502 21.9446C104.379 22.6092 104.28 23.643 104.231 24.1846C103.197 24.7261 102.016 24.8984 100.44 24.8984C96.8711 24.8984 94.4834 22.7076 94.4834 18.843C94.4834 15.4707 96.6742 12.6399 100.268 12.6399C103.714 12.6399 105.24 15.1753 105.24 17.6615C105.24 18.1292 105.191 18.6707 105.142 18.9661ZM97.4618 17.243H99.5295C100.711 17.243 101.917 17.2184 102.336 17.1692C102.385 15.9876 101.72 14.6092 99.9726 14.6092C98.348 14.6092 97.5849 15.9876 97.4618 17.243Z" fill="#4F4CD8"/>
14
+ </svg>
Binary file
@@ -0,0 +1,23 @@
1
+ <svg width="390" height="844" viewBox="0 0 390 844" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g filter="url(#filter0_n_13965_16428)">
3
+ <rect width="390" height="844" fill="white"/>
4
+ </g>
5
+ <defs>
6
+ <filter id="filter0_n_13965_16428" x="0" y="0" width="390" height="844" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
7
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
8
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
9
+ <feTurbulence type="fractalNoise" baseFrequency="3.3333332538604736 3.3333332538604736" stitchTiles="stitch" numOctaves="3" result="noise" seed="198" />
10
+ <feColorMatrix in="noise" type="luminanceToAlpha" result="alphaNoise" />
11
+ <feComponentTransfer in="alphaNoise" result="coloredNoise1">
12
+ <feFuncA type="discrete" tableValues="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "/>
13
+ </feComponentTransfer>
14
+ <feComposite operator="in" in2="shape" in="coloredNoise1" result="noise1Clipped" />
15
+ <feFlood flood-color="#0000001F" result="color1Flood" />
16
+ <feComposite operator="in" in2="noise1Clipped" in="color1Flood" result="color1" />
17
+ <feMerge result="effect1_noise_13965_16428">
18
+ <feMergeNode in="shape" />
19
+ <feMergeNode in="color1" />
20
+ </feMerge>
21
+ </filter>
22
+ </defs>
23
+ </svg>