@redotech/redo-hydrogen 1.4.6 → 1.4.8
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/.claude/settings.local.json +34 -0
- package/.github/workflows/ci.yml +56 -0
- package/.github/workflows/e2e.yml +72 -0
- package/.github/workflows/publish.yml +36 -0
- package/.prettierrc +7 -0
- package/.vscode/settings.json +10 -0
- package/CHANGELOG.md +32 -24
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/types.d.ts +24 -4
- package/eslint.config.mjs +22 -0
- package/package.json +13 -3
- package/src/components/redo-checkout-buttons.tsx +58 -74
- package/src/components/redo-info-modal.tsx +486 -345
- package/src/hooks/use-purple-dot-preorder.ts +39 -0
- package/src/index.ts +14 -4
- package/src/providers/redo-coverage-client.tsx +69 -70
- package/src/svg.d.ts +2 -2
- package/src/types.ts +30 -23
- package/src/utils/cart.ts +137 -147
- package/src/utils/purple-dot.ts +86 -0
- package/src/utils/react-utils.ts +9 -14
- package/src/utils/security.ts +3 -8
- package/src/utils/timeout.ts +1 -6
|
@@ -7,40 +7,44 @@ import FeaturedPackageCheckIcon from "./icons/featured-package-check.svg";
|
|
|
7
7
|
import FeaturedLaptopIcon from "./icons/featured-laptop-2.svg";
|
|
8
8
|
import FeaturedRefreshIcon from "./icons/featured-refresh-cw-3.svg";
|
|
9
9
|
import RedoLogo from "./icons/logo.svg";
|
|
10
|
-
import CloseIcon from "./icons/modal-close-button.svg"
|
|
11
|
-
|
|
10
|
+
import CloseIcon from "./icons/modal-close-button.svg";
|
|
12
11
|
|
|
13
12
|
interface RedoInfoModalProps {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
showInfoIcon?: boolean;
|
|
14
|
+
onInfoClick?: () => void;
|
|
15
|
+
infoCardImageUrl?: string;
|
|
16
|
+
infoModalLogoUrl?: string;
|
|
17
|
+
infoModalImageUrl?: string;
|
|
18
|
+
infoModalContent?: ReactNode;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
function useInjectStyle(styleContent: string) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const styleTag = document.createElement("style");
|
|
24
|
+
styleTag.textContent = styleContent;
|
|
25
|
+
document.head.appendChild(styleTag);
|
|
26
|
+
return () => {
|
|
27
|
+
if (styleTag?.parentElement) {
|
|
28
|
+
styleTag.parentElement.removeChild(styleTag);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}, [styleContent]);
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
const Modal = ({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
const Modal = ({
|
|
35
|
+
open,
|
|
36
|
+
onClose,
|
|
37
|
+
infoModalLogoUrl,
|
|
38
|
+
infoModalImageUrl,
|
|
39
|
+
modalContent,
|
|
40
|
+
}: {
|
|
41
|
+
open: boolean;
|
|
42
|
+
onClose: () => void;
|
|
43
|
+
infoModalLogoUrl?: string;
|
|
44
|
+
infoModalImageUrl?: string;
|
|
45
|
+
modalContent?: ReactNode;
|
|
42
46
|
}) => {
|
|
43
|
-
|
|
47
|
+
useInjectStyle(`
|
|
44
48
|
${fadeInKeyframes}
|
|
45
49
|
${slideInKeyframes}
|
|
46
50
|
|
|
@@ -71,338 +75,477 @@ const Modal = ({ open, onClose, infoModalLogoUrl, infoModalImageUrl, modalConten
|
|
|
71
75
|
}
|
|
72
76
|
`);
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
if (!open) return <></>;
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
80
|
+
const fullModalContent = (
|
|
81
|
+
<div
|
|
82
|
+
className="redo-info-modal__backgroundContainer"
|
|
83
|
+
style={{
|
|
84
|
+
position: "fixed",
|
|
85
|
+
top: 0,
|
|
86
|
+
left: 0,
|
|
87
|
+
right: 0,
|
|
88
|
+
bottom: 0,
|
|
89
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
90
|
+
display: "flex",
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
justifyContent: "center",
|
|
93
|
+
zIndex: 99999,
|
|
94
|
+
transform: "translateZ(0)",
|
|
95
|
+
opacity: 1,
|
|
96
|
+
transition: "opacity 0.2s ease-in-out",
|
|
97
|
+
animation: "fadeIn 0.2s ease-in-out",
|
|
98
|
+
}}
|
|
99
|
+
onClick={onClose}
|
|
100
|
+
>
|
|
101
|
+
<div
|
|
102
|
+
className="redo-info-modal__container"
|
|
103
|
+
style={{
|
|
104
|
+
backgroundColor: "white",
|
|
105
|
+
borderRadius: "8px",
|
|
106
|
+
width: "700px",
|
|
107
|
+
maxWidth: "900px",
|
|
108
|
+
position: "absolute",
|
|
109
|
+
top: "50%",
|
|
110
|
+
left: "50%",
|
|
111
|
+
transform: "translate(-50%, -50%)",
|
|
112
|
+
zIndex: 100000,
|
|
113
|
+
display: "flex",
|
|
114
|
+
flexDirection: "row",
|
|
115
|
+
alignItems: "center",
|
|
116
|
+
justifyContent: "left",
|
|
117
|
+
maxHeight: "95%",
|
|
118
|
+
boxShadow: "0 4px 8px 0 rgba(0, 0, 0, 0.2)",
|
|
119
|
+
opacity: 1,
|
|
120
|
+
transition: "opacity 0.2s ease-in-out, transform 0.2s ease-in-out",
|
|
121
|
+
animation: "slideIn 0.2s ease-in-out forwards",
|
|
122
|
+
minHeight: "100px",
|
|
123
|
+
}}
|
|
124
|
+
onClick={(e) => e.stopPropagation()}
|
|
125
|
+
>
|
|
126
|
+
<button
|
|
127
|
+
className="redo-info-modal__closeButton"
|
|
128
|
+
onClick={onClose}
|
|
129
|
+
style={{
|
|
130
|
+
position: "absolute",
|
|
131
|
+
right: "16px",
|
|
132
|
+
top: "16px",
|
|
133
|
+
border: "none",
|
|
134
|
+
background: "none",
|
|
135
|
+
fontSize: "20px",
|
|
136
|
+
cursor: "pointer",
|
|
137
|
+
padding: "4px",
|
|
138
|
+
zIndex: 1,
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
<CloseIcon />
|
|
142
|
+
</button>
|
|
143
|
+
{infoModalImageUrl ? (
|
|
144
|
+
<div
|
|
145
|
+
className="redo-info-modal__sideImageContainer"
|
|
146
|
+
style={{
|
|
147
|
+
minWidth: "200px",
|
|
148
|
+
width: "200px",
|
|
149
|
+
backgroundImage: `url(${infoModalImageUrl})`,
|
|
150
|
+
backgroundSize: "cover",
|
|
151
|
+
backgroundPosition: "center center",
|
|
152
|
+
borderTopLeftRadius: "8px",
|
|
153
|
+
borderBottomLeftRadius: "8px",
|
|
154
|
+
alignSelf: "stretch",
|
|
155
|
+
}}
|
|
156
|
+
></div>
|
|
157
|
+
) : null}
|
|
158
|
+
{modalContent ? (
|
|
159
|
+
modalContent
|
|
160
|
+
) : (
|
|
161
|
+
<div
|
|
162
|
+
className="redo-info-modal__contentContainer"
|
|
163
|
+
style={{
|
|
164
|
+
padding: "24px",
|
|
165
|
+
fontFamily: 'Inter, "Helvetica Neue", Arial, sans-serif',
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
168
|
+
<div
|
|
169
|
+
className="redo-info-modal__logoContainer"
|
|
170
|
+
style={{
|
|
171
|
+
width: "100%",
|
|
172
|
+
height: "100%",
|
|
173
|
+
display: "block",
|
|
174
|
+
marginBottom: "8px",
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
{infoModalLogoUrl ? (
|
|
178
|
+
<img
|
|
179
|
+
src={infoModalLogoUrl}
|
|
180
|
+
className="redo-info-modal__logo"
|
|
181
|
+
style={{
|
|
182
|
+
width: "auto",
|
|
183
|
+
height: "112px",
|
|
184
|
+
display: "block",
|
|
185
|
+
}}
|
|
186
|
+
/>
|
|
187
|
+
) : (
|
|
188
|
+
<RedoLogo width="112px" height="112px" display="block" />
|
|
189
|
+
)}
|
|
190
|
+
</div>
|
|
191
|
+
<p
|
|
192
|
+
style={{
|
|
193
|
+
fontSize: "20px",
|
|
194
|
+
fontWeight: "600",
|
|
195
|
+
}}
|
|
196
|
+
className="redo-info-modal__title"
|
|
197
|
+
>
|
|
198
|
+
Checkout with confidence
|
|
199
|
+
</p>
|
|
200
|
+
|
|
201
|
+
<p
|
|
202
|
+
style={{
|
|
203
|
+
fontSize: "14px",
|
|
204
|
+
color: "#666",
|
|
205
|
+
marginBottom: "24px",
|
|
206
|
+
}}
|
|
207
|
+
className="redo-info-modal__description"
|
|
208
|
+
>
|
|
209
|
+
Shop with confidence, knowing your purchases are protected every step of the way.
|
|
210
|
+
</p>
|
|
211
|
+
|
|
212
|
+
<div className="redo-info-modal__benefitsContainer" style={{ marginBottom: "24px" }}>
|
|
213
|
+
<div className="redo-info-modal__benefit" style={{ marginBottom: "16px" }}>
|
|
214
|
+
<div
|
|
215
|
+
className="redo-info-modal__benefitIconContainer"
|
|
216
|
+
style={{
|
|
217
|
+
display: "flex",
|
|
218
|
+
flexDirection: "row",
|
|
219
|
+
alignItems: "flex-start",
|
|
220
|
+
justifyContent: "flex-start",
|
|
221
|
+
gap: "10px",
|
|
222
|
+
}}
|
|
128
223
|
>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
width: '100%',
|
|
151
|
-
height: '100%',
|
|
152
|
-
display: 'block',
|
|
153
|
-
marginBottom: '8px'
|
|
154
|
-
}}>
|
|
155
|
-
{infoModalLogoUrl ? (
|
|
156
|
-
<img src={infoModalLogoUrl} className="redo-info-modal__logo" style={{
|
|
157
|
-
width: 'auto',
|
|
158
|
-
height: '112px',
|
|
159
|
-
display: 'block',
|
|
160
|
-
}}/>
|
|
161
|
-
) : <RedoLogo width="112px" height="112px" display="block"/>}
|
|
162
|
-
</div>
|
|
163
|
-
<p style={{
|
|
164
|
-
fontSize: '20px',
|
|
165
|
-
fontWeight: '600'
|
|
166
|
-
}} className="redo-info-modal__title">
|
|
167
|
-
Checkout with confidence
|
|
224
|
+
<div
|
|
225
|
+
className="redo-info-modal__benefitIcon"
|
|
226
|
+
style={{
|
|
227
|
+
display: "flex",
|
|
228
|
+
alignItems: "center",
|
|
229
|
+
justifyContent: "center",
|
|
230
|
+
width: "36px",
|
|
231
|
+
height: "36px",
|
|
232
|
+
}}
|
|
233
|
+
>
|
|
234
|
+
<FeaturedRefreshIcon height="32" width="32" />
|
|
235
|
+
</div>
|
|
236
|
+
<div
|
|
237
|
+
className="redo-info-modal__benefitTextContainer"
|
|
238
|
+
style={{ display: "flex", flexDirection: "column", alignItems: "flex-start" }}
|
|
239
|
+
>
|
|
240
|
+
<p
|
|
241
|
+
className="redo-info-modal__benefitText"
|
|
242
|
+
style={{ fontSize: "16px", fontWeight: "600", marginBottom: "4px" }}
|
|
243
|
+
>
|
|
244
|
+
Free returns & exchanges
|
|
168
245
|
</p>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
fontSize: '14px',
|
|
172
|
-
color: '#666',
|
|
173
|
-
marginBottom: '24px'
|
|
174
|
-
}} className="redo-info-modal__description">
|
|
175
|
-
Shop with confidence, knowing your purchases are protected every step of the way.
|
|
246
|
+
<p className="redo-info-modal__benefitSmallText" style={{ fontSize: "12px", color: "#666" }}>
|
|
247
|
+
Return or exchange your items for free. If you're not completely satisfied, we've got you covered.
|
|
176
248
|
</p>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
177
252
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
<FeaturedLaptopIcon height="32" width="32" />
|
|
222
|
-
</div>
|
|
223
|
-
<div className="redo-info-modal__benefitTextContainer" style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
|
|
224
|
-
<p className="redo-info-modal__benefitText" style={{
|
|
225
|
-
fontSize: '16px',
|
|
226
|
-
fontWeight: '600',
|
|
227
|
-
marginBottom: '4px'
|
|
228
|
-
}}>
|
|
229
|
-
Easy return portal
|
|
230
|
-
</p>
|
|
231
|
-
<p className="redo-info-modal__benefitSmallText" style={{
|
|
232
|
-
fontSize: '12px',
|
|
233
|
-
color: '#666'
|
|
234
|
-
}}>
|
|
235
|
-
Skip all the back and forth, and submit your return in a few clicks.
|
|
236
|
-
</p>
|
|
237
|
-
</div>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
253
|
+
<div className="redo-info-modal__benefit" style={{ marginBottom: "16px" }}>
|
|
254
|
+
<div
|
|
255
|
+
className="redo-info-modal__benefitIconContainer"
|
|
256
|
+
style={{ display: "flex", flexDirection: "row", alignItems: "flex-start", gap: "10px" }}
|
|
257
|
+
>
|
|
258
|
+
<div
|
|
259
|
+
className="redo-info-modal__benefitIcon"
|
|
260
|
+
style={{
|
|
261
|
+
display: "flex",
|
|
262
|
+
alignItems: "center",
|
|
263
|
+
justifyContent: "center",
|
|
264
|
+
width: "36px",
|
|
265
|
+
height: "36px",
|
|
266
|
+
}}
|
|
267
|
+
>
|
|
268
|
+
<FeaturedPackageCheckIcon height="32" width="32" />
|
|
269
|
+
</div>
|
|
270
|
+
<div
|
|
271
|
+
className="redo-info-modal__benefitTextContainer"
|
|
272
|
+
style={{ display: "flex", flexDirection: "column", alignItems: "flex-start" }}
|
|
273
|
+
>
|
|
274
|
+
<p
|
|
275
|
+
className="redo-info-modal__benefitText"
|
|
276
|
+
style={{
|
|
277
|
+
fontSize: "16px",
|
|
278
|
+
fontWeight: "600",
|
|
279
|
+
marginBottom: "4px",
|
|
280
|
+
}}
|
|
281
|
+
>
|
|
282
|
+
Package protection
|
|
283
|
+
</p>
|
|
284
|
+
<p
|
|
285
|
+
className="redo-info-modal__benefitSmallText"
|
|
286
|
+
style={{
|
|
287
|
+
fontSize: "12px",
|
|
288
|
+
color: "#666",
|
|
289
|
+
}}
|
|
290
|
+
>
|
|
291
|
+
Rest assured, if your package is lost, stolen, or damaged, we've got you covered.
|
|
292
|
+
</p>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
241
296
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
297
|
+
<div className="redo-info-modal__benefit" style={{ marginBottom: "16px" }}>
|
|
298
|
+
<div
|
|
299
|
+
className="redo-info-modal__benefitIconContainer"
|
|
300
|
+
style={{ display: "flex", flexDirection: "row", alignItems: "flex-start", gap: "10px" }}
|
|
301
|
+
>
|
|
302
|
+
<div
|
|
303
|
+
className="redo-info-modal__benefitIcon"
|
|
304
|
+
style={{
|
|
305
|
+
display: "flex",
|
|
306
|
+
alignItems: "center",
|
|
307
|
+
justifyContent: "center",
|
|
308
|
+
width: "36px",
|
|
309
|
+
height: "36px",
|
|
310
|
+
}}
|
|
311
|
+
>
|
|
312
|
+
<FeaturedLaptopIcon height="32" width="32" />
|
|
313
|
+
</div>
|
|
314
|
+
<div
|
|
315
|
+
className="redo-info-modal__benefitTextContainer"
|
|
316
|
+
style={{ display: "flex", flexDirection: "column", alignItems: "flex-start" }}
|
|
317
|
+
>
|
|
318
|
+
<p
|
|
319
|
+
className="redo-info-modal__benefitText"
|
|
320
|
+
style={{
|
|
321
|
+
fontSize: "16px",
|
|
322
|
+
fontWeight: "600",
|
|
323
|
+
marginBottom: "4px",
|
|
324
|
+
}}
|
|
325
|
+
>
|
|
326
|
+
Easy return portal
|
|
260
327
|
</p>
|
|
328
|
+
<p
|
|
329
|
+
className="redo-info-modal__benefitSmallText"
|
|
330
|
+
style={{
|
|
331
|
+
fontSize: "12px",
|
|
332
|
+
color: "#666",
|
|
333
|
+
}}
|
|
334
|
+
>
|
|
335
|
+
Skip all the back and forth, and submit your return in a few clicks.
|
|
336
|
+
</p>
|
|
337
|
+
</div>
|
|
261
338
|
</div>
|
|
262
|
-
|
|
339
|
+
</div>
|
|
263
340
|
</div>
|
|
264
|
-
</div>
|
|
265
|
-
);
|
|
266
341
|
|
|
267
|
-
|
|
342
|
+
<p
|
|
343
|
+
className="redo-info-modal__footerText"
|
|
344
|
+
style={{
|
|
345
|
+
fontSize: "12px",
|
|
346
|
+
color: "#666",
|
|
347
|
+
}}
|
|
348
|
+
>
|
|
349
|
+
By purchasing Redo, you agree and have read the{" "}
|
|
350
|
+
<a
|
|
351
|
+
href="https://www.getredo.com/privacy-policy"
|
|
352
|
+
target="_blank"
|
|
353
|
+
rel="noopener noreferrer"
|
|
354
|
+
style={{ color: "#000", textDecoration: "underline" }}
|
|
355
|
+
>
|
|
356
|
+
Privacy Policy
|
|
357
|
+
</a>{" "}
|
|
358
|
+
and{" "}
|
|
359
|
+
<a
|
|
360
|
+
href="https://www.getredo.com/terms-conditions"
|
|
361
|
+
target="_blank"
|
|
362
|
+
rel="noopener noreferrer"
|
|
363
|
+
style={{ color: "#000", textDecoration: "underline" }}
|
|
364
|
+
>
|
|
365
|
+
Terms and Conditions
|
|
366
|
+
</a>
|
|
367
|
+
. Redo is subject to Merchant's Return Policy.
|
|
368
|
+
</p>
|
|
369
|
+
</div>
|
|
370
|
+
)}
|
|
371
|
+
</div>
|
|
372
|
+
</div>
|
|
373
|
+
);
|
|
374
|
+
|
|
375
|
+
return createPortal(fullModalContent, document.body);
|
|
268
376
|
};
|
|
269
377
|
|
|
270
|
-
const RedoInfoCard = ({
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
378
|
+
const RedoInfoCard = ({
|
|
379
|
+
showInfoIcon = true,
|
|
380
|
+
onInfoClick,
|
|
381
|
+
infoCardImageUrl,
|
|
382
|
+
infoModalLogoUrl,
|
|
383
|
+
infoModalImageUrl,
|
|
384
|
+
infoModalContent,
|
|
277
385
|
}: RedoInfoModalProps) => {
|
|
278
|
-
|
|
279
|
-
|
|
386
|
+
const { price, eligible } = useRedoCoverageClient();
|
|
387
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
280
388
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
if (!eligible) {
|
|
290
|
-
return <></>;
|
|
389
|
+
const handleInfoClick = () => {
|
|
390
|
+
if (onInfoClick) {
|
|
391
|
+
onInfoClick();
|
|
392
|
+
} else {
|
|
393
|
+
setIsModalOpen(true);
|
|
291
394
|
}
|
|
395
|
+
};
|
|
292
396
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
397
|
+
if (!eligible) {
|
|
398
|
+
return <></>;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return (
|
|
402
|
+
<>
|
|
403
|
+
<div
|
|
404
|
+
className="redo-info-card__container"
|
|
405
|
+
data-target="info-card-container"
|
|
406
|
+
style={{
|
|
407
|
+
display: "flex",
|
|
408
|
+
borderRadius: "4px",
|
|
409
|
+
padding: "12px",
|
|
410
|
+
alignItems: "center",
|
|
411
|
+
gap: "12px",
|
|
412
|
+
marginTop: "8px",
|
|
413
|
+
}}
|
|
414
|
+
>
|
|
415
|
+
<div
|
|
416
|
+
className="redo-info-card__imageContainer"
|
|
417
|
+
style={{
|
|
418
|
+
width: "44px",
|
|
419
|
+
height: "44px",
|
|
420
|
+
borderRadius: "100%",
|
|
421
|
+
display: "flex",
|
|
422
|
+
justifyContent: "center",
|
|
423
|
+
alignItems: "center",
|
|
424
|
+
flexShrink: 0,
|
|
425
|
+
}}
|
|
426
|
+
>
|
|
427
|
+
{infoCardImageUrl ? (
|
|
428
|
+
<img
|
|
429
|
+
src={infoCardImageUrl}
|
|
430
|
+
alt="Redo Info"
|
|
431
|
+
className="redo-info-card__image"
|
|
432
|
+
style={{
|
|
433
|
+
width: "100%",
|
|
434
|
+
height: "100%",
|
|
435
|
+
objectFit: "contain",
|
|
436
|
+
}}
|
|
437
|
+
/>
|
|
438
|
+
) : (
|
|
439
|
+
<ShieldIcon
|
|
440
|
+
viewBox="0 0 24 24"
|
|
441
|
+
style={{
|
|
442
|
+
width: "100%",
|
|
443
|
+
height: "100%",
|
|
444
|
+
color: "black",
|
|
445
|
+
display: "block",
|
|
446
|
+
}}
|
|
447
|
+
/>
|
|
448
|
+
)}
|
|
449
|
+
</div>
|
|
450
|
+
|
|
451
|
+
<div
|
|
452
|
+
className="redo-info-card__content"
|
|
453
|
+
data-target="text-and-buttons-container"
|
|
454
|
+
style={{
|
|
455
|
+
flex: 1,
|
|
456
|
+
}}
|
|
457
|
+
>
|
|
458
|
+
<div
|
|
459
|
+
className="redo-info-card__textWrapper"
|
|
460
|
+
style={{
|
|
461
|
+
display: "flex",
|
|
462
|
+
flexDirection: "column",
|
|
463
|
+
}}
|
|
464
|
+
>
|
|
465
|
+
<span
|
|
466
|
+
className="redo-info-card__title"
|
|
467
|
+
data-target="toggle-label"
|
|
468
|
+
style={{
|
|
469
|
+
color: "#000000",
|
|
470
|
+
fontSize: "14px",
|
|
471
|
+
fontWeight: 600,
|
|
472
|
+
display: "flex",
|
|
473
|
+
alignItems: "center",
|
|
474
|
+
gap: "5px",
|
|
475
|
+
verticalAlign: "middle",
|
|
476
|
+
}}
|
|
477
|
+
>
|
|
478
|
+
Checkout+
|
|
479
|
+
{showInfoIcon && (
|
|
480
|
+
<span className="redo-info-card__infoIconWrapper" data-target="toggle-info">
|
|
481
|
+
<button
|
|
482
|
+
className="redo-info-card__infoButton"
|
|
483
|
+
data-target="toggle-info-button"
|
|
484
|
+
onClick={handleInfoClick}
|
|
485
|
+
type="button"
|
|
486
|
+
style={{
|
|
487
|
+
border: "none",
|
|
488
|
+
background: "none",
|
|
489
|
+
padding: 0,
|
|
490
|
+
cursor: "pointer",
|
|
491
|
+
color: "#969696",
|
|
492
|
+
display: "flex",
|
|
493
|
+
alignItems: "center",
|
|
494
|
+
justifyContent: "center",
|
|
495
|
+
}}
|
|
496
|
+
>
|
|
497
|
+
<InfoIcon
|
|
498
|
+
style={{
|
|
499
|
+
width: "16px",
|
|
500
|
+
height: "16px",
|
|
501
|
+
verticalAlign: "middle",
|
|
502
|
+
}}
|
|
503
|
+
className="redo-info-card__infoIcon"
|
|
504
|
+
/>
|
|
505
|
+
</button>
|
|
506
|
+
</span>
|
|
507
|
+
)}
|
|
508
|
+
</span>
|
|
509
|
+
<p
|
|
510
|
+
className="redo-info-card__subtext"
|
|
511
|
+
data-target="toggle-subtext"
|
|
512
|
+
style={{
|
|
513
|
+
color: "#000000",
|
|
514
|
+
fontSize: "12px",
|
|
515
|
+
lineHeight: "16px",
|
|
516
|
+
}}
|
|
517
|
+
>
|
|
518
|
+
Free Returns + Package Protection
|
|
519
|
+
</p>
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
|
|
523
|
+
<div className="redo-info-card__priceContainer">
|
|
524
|
+
<p
|
|
525
|
+
style={{
|
|
526
|
+
color: "#000000",
|
|
527
|
+
fontSize: "14px",
|
|
528
|
+
fontWeight: 400,
|
|
529
|
+
}}
|
|
530
|
+
className="redo-info-card__price"
|
|
531
|
+
data-target="price"
|
|
532
|
+
>
|
|
533
|
+
${price}
|
|
534
|
+
</p>
|
|
535
|
+
</div>
|
|
536
|
+
</div>
|
|
537
|
+
|
|
538
|
+
{!onInfoClick && (
|
|
539
|
+
<Modal
|
|
540
|
+
open={isModalOpen}
|
|
541
|
+
onClose={() => setIsModalOpen(false)}
|
|
542
|
+
infoModalLogoUrl={infoModalLogoUrl}
|
|
543
|
+
infoModalImageUrl={infoModalImageUrl}
|
|
544
|
+
modalContent={infoModalContent}
|
|
545
|
+
/>
|
|
546
|
+
)}
|
|
547
|
+
</>
|
|
548
|
+
);
|
|
406
549
|
};
|
|
407
550
|
|
|
408
551
|
const fadeInKeyframes = `
|
|
@@ -429,6 +572,4 @@ const slideInKeyframes = `
|
|
|
429
572
|
}
|
|
430
573
|
`;
|
|
431
574
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
export { RedoInfoCard };
|
|
575
|
+
export { RedoInfoCard };
|