@frak-labs/components 1.3.4 → 1.5.0-beta.04afaf6b
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/cdn/Ambassador.Cmb0kX5D.js +519 -0
- package/cdn/Banner.2WJ4pT6E.js +227 -0
- package/cdn/ButtonShare.DSGvJfJ-.js +1 -0
- package/cdn/{ButtonWallet.CIesaq0l.js → ButtonWallet.DHpHCl4c.js} +2 -2
- package/cdn/GiftIcon.DYg5xgHg.js +1 -0
- package/cdn/InstallQr.CHImaq56.js +1 -0
- package/cdn/{OpenInAppButton.BtXknsxK.js → OpenInAppButton.CxBzRNKw.js} +1 -1
- package/cdn/PostPurchase.C75q-9BM.js +124 -0
- package/cdn/RewardReminder.C6o8lgak.js +369 -0
- package/cdn/components.js +1 -1
- package/cdn/format.D2Ai5cCn.js +1 -0
- package/cdn/{GiftIcon.CX0gLPUJ.js → icons.CdzHzZIJ.js} +1 -1
- package/cdn/jsxRuntime.module.7FJBZ9bf.js +58 -0
- package/cdn/loader.js +20 -16
- package/cdn/mountRewardReminder.BlmSRJDe.js +1 -0
- package/cdn/previewSummary.DxyobqED.js +1 -0
- package/cdn/replay-V6FXES7X.CgBxdfNp.js +1 -0
- package/cdn/rewardSummaryStore.DyjI-vPH.js +1 -0
- package/cdn/{rewards.F9iOJSNk.js → rewards.CeNLrK54.js} +1 -1
- package/cdn/useGlobalComponents.CNnOzerU.js +1 -0
- package/cdn/{useLightDomStyles.CpiH8nO2.js → useLightDomStyles.557xWurb.js} +1 -1
- package/cdn/usePlacement.DYgmdkfr.js +1 -0
- package/cdn/{useReward.B9ibElG0.js → useReward.BzUL3ijd.js} +1 -1
- package/dist/GiftIcon-Csu31jtf.js +62 -0
- package/dist/InstallQr-kpb44cfg.js +84 -0
- package/dist/ambassador.d.ts +16 -1
- package/dist/ambassador.js +626 -191
- package/dist/banner.d.ts +20 -6
- package/dist/banner.js +237 -15
- package/dist/buttonShare.js +2 -2
- package/dist/buttonWallet.js +1 -1
- package/dist/format-zGdbUoX_.js +283 -0
- package/dist/i18n/defaults.d.ts +72 -0
- package/dist/i18n/defaults.js +108 -6
- package/dist/{GiftIcon-B9k_syq6.js → icons-iN3qH_Bv.js} +1 -61
- package/dist/postPurchase.d.ts +6 -1
- package/dist/postPurchase.js +188 -34
- package/dist/previewSummary-CMc6q8vI.js +37 -0
- package/dist/rewardReminder.d.ts +50 -0
- package/dist/rewardReminder.js +809 -0
- package/dist/{rewards-CfGynCt6.js → rewards-BuNthAR2.js} +49 -46
- package/dist/{sharedBaseCss.css-nYy9vlzH.js → sharedBaseCss.css-D2HG4Ty8.js} +1 -1
- package/dist/{useReward-DmukZKoh.js → useReward-cQ54x8q-.js} +1 -1
- package/package.json +18 -12
- package/cdn/Ambassador.tWpfYThv.js +0 -392
- package/cdn/Banner.RSZt2Kn_.js +0 -208
- package/cdn/ButtonShare.Buy6qEfW.js +0 -1
- package/cdn/PostPurchase.Btgp2kLc.js +0 -102
- package/cdn/jsxRuntime.module.CUZaa90V.js +0 -58
- package/cdn/replay-V6FXES7X.efKsNT6s.js +0 -1
- package/cdn/useGlobalComponents.CXuceSQ0.js +0 -1
- package/cdn/usePlacement.Cq64cZ9Q.js +0 -1
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
import { a as useClientReady, i as subscribeSdkConfig, o as registerWebComponent, r as useLang, t as buildStyleContent } from "./sharedCss-SKmJGZgN.js";
|
|
2
|
+
import { t as useGlobalComponents } from "./useGlobalComponents-BF47jsBt.js";
|
|
3
|
+
import { componentDefaults } from "./i18n/defaults.js";
|
|
4
|
+
import { n as getCountdownLabel, t as getPreviewPending } from "./previewSummary-CMc6q8vI.js";
|
|
5
|
+
import { a as resolveRewardCurrency, c as isClaimable, f as useReminderDismissed, i as pickFiat, l as markClaimStarted, n as formatFiat, o as getRewardCountdown, p as dismissReminder, r as formatRewardDate, s as useRewardSummary, t as fillReminderText, u as useHasInlineReminder } from "./format-zGdbUoX_.js";
|
|
6
|
+
import { t as GiftIcon } from "./GiftIcon-Csu31jtf.js";
|
|
7
|
+
import { n as QrSvg, r as useInstallQr } from "./InstallQr-kpb44cfg.js";
|
|
8
|
+
import { isMobile, sdkConfigStore, trackEvent } from "@frak-labs/core-sdk";
|
|
9
|
+
import { getInstallUrl } from "@frak-labs/core-sdk/actions";
|
|
10
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "preact/hooks";
|
|
11
|
+
import { useSyncExternalStore } from "preact/compat";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
13
|
+
// \0ve-inline:src/components/RewardReminder/RewardReminder.css.ts.vanilla.js
|
|
14
|
+
const cssSource$1 = `@keyframes RewardReminder_rise__1gewp7n0 {
|
|
15
|
+
from {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
transform: translateY(8px);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
to {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
transform: translateY(0);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@keyframes RewardReminder_wiggle__1gewp7n1 {
|
|
27
|
+
0%, 100% {
|
|
28
|
+
transform: rotate(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
25% {
|
|
32
|
+
transform: rotate(-12deg);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
50% {
|
|
36
|
+
transform: rotate(10deg);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
75% {
|
|
40
|
+
transform: rotate(-5deg);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@keyframes RewardReminder_pop__1gewp7n2 {
|
|
45
|
+
from {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
transform: scale(.6);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
to {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
transform: scale(1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.RewardReminder_box__1gewp7n3 {
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
text-transform: none;
|
|
59
|
+
letter-spacing: normal;
|
|
60
|
+
word-spacing: normal;
|
|
61
|
+
margin: 0;
|
|
62
|
+
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
|
|
63
|
+
font-style: normal;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.RewardReminder_control__1gewp7n4 {
|
|
67
|
+
appearance: none;
|
|
68
|
+
color: inherit;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
background: none;
|
|
71
|
+
border: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.RewardReminder_control__1gewp7n4:focus-visible {
|
|
75
|
+
outline-offset: 2px;
|
|
76
|
+
outline: 2px solid #2563eb;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.RewardReminder_root__1gewp7n5 {
|
|
80
|
+
bottom: var(--frak-reminder-bottom, 20px);
|
|
81
|
+
z-index: 2000000;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
gap: 8px;
|
|
84
|
+
max-width: calc(100vw - 32px);
|
|
85
|
+
display: flex;
|
|
86
|
+
position: fixed;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.RewardReminder_sideLeft__1gewp7n6 {
|
|
90
|
+
align-items: flex-start;
|
|
91
|
+
left: 16px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.RewardReminder_sideRight__1gewp7n7 {
|
|
95
|
+
align-items: flex-end;
|
|
96
|
+
right: 16px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.RewardReminder_pillRow__1gewp7n8 {
|
|
100
|
+
color: #fff;
|
|
101
|
+
background-color: #111827;
|
|
102
|
+
border-radius: 999px;
|
|
103
|
+
align-items: center;
|
|
104
|
+
animation: .3s ease-out RewardReminder_rise__1gewp7n0;
|
|
105
|
+
display: flex;
|
|
106
|
+
box-shadow: 0 4px 14px #00000040;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.RewardReminder_pillRowUrgent__1gewp7n9 {
|
|
110
|
+
background-color: #b42318;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.RewardReminder_pill__1gewp7na {
|
|
114
|
+
text-align: left;
|
|
115
|
+
border-radius: 999px;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: 8px;
|
|
118
|
+
padding: 8px 4px 8px 12px;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
line-height: 18px;
|
|
121
|
+
display: flex;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.RewardReminder_icon__1gewp7nb {
|
|
125
|
+
flex-shrink: 0;
|
|
126
|
+
width: 22px;
|
|
127
|
+
height: 22px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.RewardReminder_pillAmount__1gewp7nc {
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
font-weight: 700;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.RewardReminder_pillCountdown__1gewp7nd {
|
|
136
|
+
opacity: .9;
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
font-size: 12px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.RewardReminder_dismiss__1gewp7ne {
|
|
142
|
+
opacity: .8;
|
|
143
|
+
border-radius: 50%;
|
|
144
|
+
width: 28px;
|
|
145
|
+
height: 28px;
|
|
146
|
+
margin-right: 6px;
|
|
147
|
+
font-size: 18px;
|
|
148
|
+
line-height: 28px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.RewardReminder_dismiss__1gewp7ne:hover {
|
|
152
|
+
opacity: 1;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.RewardReminder_card__1gewp7nf {
|
|
156
|
+
color: #111827;
|
|
157
|
+
background-color: #fff;
|
|
158
|
+
border-radius: 16px;
|
|
159
|
+
width: min(360px, 100vw - 32px);
|
|
160
|
+
padding: 16px;
|
|
161
|
+
animation: .2s ease-out RewardReminder_rise__1gewp7n0;
|
|
162
|
+
box-shadow: 0 12px 32px #00000040;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.RewardReminder_card__1gewp7nf:focus {
|
|
166
|
+
outline: none;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.RewardReminder_cardHeader__1gewp7ng {
|
|
170
|
+
align-items: center;
|
|
171
|
+
gap: 8px;
|
|
172
|
+
display: flex;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.RewardReminder_eyebrow__1gewp7nh {
|
|
176
|
+
color: #374151;
|
|
177
|
+
flex: 1;
|
|
178
|
+
align-items: center;
|
|
179
|
+
gap: 8px;
|
|
180
|
+
font-size: 14px;
|
|
181
|
+
font-weight: 600;
|
|
182
|
+
line-height: 18px;
|
|
183
|
+
display: flex;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.RewardReminder_eyebrowIcon__1gewp7ni {
|
|
187
|
+
transform-origin: 50% 80%;
|
|
188
|
+
flex-shrink: 0;
|
|
189
|
+
width: 22px;
|
|
190
|
+
height: 22px;
|
|
191
|
+
animation: .7s ease-in-out .22s both RewardReminder_wiggle__1gewp7n1;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.RewardReminder_head__1gewp7nj {
|
|
195
|
+
justify-content: space-between;
|
|
196
|
+
align-items: center;
|
|
197
|
+
gap: 12px;
|
|
198
|
+
margin-top: 6px;
|
|
199
|
+
display: flex;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.RewardReminder_amount__1gewp7nk {
|
|
203
|
+
letter-spacing: -.02em;
|
|
204
|
+
font-variant-numeric: tabular-nums;
|
|
205
|
+
font-size: 40px;
|
|
206
|
+
font-weight: 800;
|
|
207
|
+
line-height: 44px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.RewardReminder_breakdown__1gewp7nl {
|
|
211
|
+
color: #6b7280;
|
|
212
|
+
margin-top: 4px;
|
|
213
|
+
font-size: 14px;
|
|
214
|
+
line-height: 18px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.RewardReminder_tile__1gewp7nm {
|
|
218
|
+
color: #111827;
|
|
219
|
+
text-align: center;
|
|
220
|
+
background-color: #fff8b8;
|
|
221
|
+
border-radius: 14px;
|
|
222
|
+
flex-direction: column;
|
|
223
|
+
flex-shrink: 0;
|
|
224
|
+
justify-content: center;
|
|
225
|
+
align-items: center;
|
|
226
|
+
min-width: 64px;
|
|
227
|
+
height: 64px;
|
|
228
|
+
padding: 0 8px;
|
|
229
|
+
animation: .42s cubic-bezier(.3, 1.6, .5, 1) .2s both RewardReminder_pop__1gewp7n2;
|
|
230
|
+
display: flex;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.RewardReminder_tileUrgent__1gewp7nn {
|
|
234
|
+
color: #b42318;
|
|
235
|
+
background-color: #fce8ea;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.RewardReminder_tileNumber__1gewp7no {
|
|
239
|
+
font-variant-numeric: tabular-nums;
|
|
240
|
+
font-size: 26px;
|
|
241
|
+
font-weight: 800;
|
|
242
|
+
line-height: 28px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.RewardReminder_tileWord__1gewp7np {
|
|
246
|
+
font-size: 18px;
|
|
247
|
+
font-weight: 800;
|
|
248
|
+
line-height: 22px;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.RewardReminder_tileUnit__1gewp7nq {
|
|
252
|
+
white-space: nowrap;
|
|
253
|
+
margin-top: 2px;
|
|
254
|
+
font-size: 11px;
|
|
255
|
+
font-weight: 600;
|
|
256
|
+
line-height: 13px;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.RewardReminder_close__1gewp7nr {
|
|
260
|
+
color: #6b7280;
|
|
261
|
+
border-radius: 50%;
|
|
262
|
+
flex-shrink: 0;
|
|
263
|
+
width: 28px;
|
|
264
|
+
height: 28px;
|
|
265
|
+
font-size: 20px;
|
|
266
|
+
line-height: 28px;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.RewardReminder_deadline__1gewp7ns {
|
|
270
|
+
color: #6b7280;
|
|
271
|
+
margin-top: 10px;
|
|
272
|
+
font-size: 13px;
|
|
273
|
+
line-height: 18px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.RewardReminder_deadlineUrgent__1gewp7nt {
|
|
277
|
+
color: #b42318;
|
|
278
|
+
font-weight: 600;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.RewardReminder_cta__1gewp7nu {
|
|
282
|
+
color: #fff;
|
|
283
|
+
text-align: center;
|
|
284
|
+
background-color: #111827;
|
|
285
|
+
border-radius: 999px;
|
|
286
|
+
margin-top: 14px;
|
|
287
|
+
padding: 12px 16px;
|
|
288
|
+
font-size: 15px;
|
|
289
|
+
font-weight: 700;
|
|
290
|
+
text-decoration: none;
|
|
291
|
+
display: block;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.RewardReminder_free__1gewp7nv {
|
|
295
|
+
color: #6b7280;
|
|
296
|
+
text-align: center;
|
|
297
|
+
margin-top: 8px;
|
|
298
|
+
font-size: 12px;
|
|
299
|
+
line-height: 16px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.RewardReminder_footer__1gewp7nw {
|
|
303
|
+
justify-content: center;
|
|
304
|
+
align-items: center;
|
|
305
|
+
gap: 12px;
|
|
306
|
+
margin-top: 4px;
|
|
307
|
+
display: flex;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.RewardReminder_footerQr__1gewp7nx {
|
|
311
|
+
border-top: 1px solid #f0efed;
|
|
312
|
+
justify-content: flex-start;
|
|
313
|
+
margin-top: 12px;
|
|
314
|
+
padding-top: 12px;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.RewardReminder_footerQrExpanded__1gewp7ny {
|
|
318
|
+
text-align: center;
|
|
319
|
+
flex-direction: column;
|
|
320
|
+
gap: 6px;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.RewardReminder_qrButton__1gewp7nz {
|
|
324
|
+
cursor: zoom-in;
|
|
325
|
+
border-radius: 6px;
|
|
326
|
+
flex-shrink: 0;
|
|
327
|
+
padding: 0;
|
|
328
|
+
line-height: 0;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.RewardReminder_qrButtonExpanded__1gewp7n10 {
|
|
332
|
+
cursor: zoom-out;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.RewardReminder_qrImage__1gewp7n11 {
|
|
336
|
+
width: 64px;
|
|
337
|
+
height: 64px;
|
|
338
|
+
transition: width .2s ease-out, height .2s ease-out;
|
|
339
|
+
display: block;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.RewardReminder_qrImageExpanded__1gewp7n12 {
|
|
343
|
+
width: 200px;
|
|
344
|
+
height: 200px;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.RewardReminder_qrPlaceholder__1gewp7n13 {
|
|
348
|
+
background-color: #f3f4f6;
|
|
349
|
+
border-radius: 6px;
|
|
350
|
+
flex-shrink: 0;
|
|
351
|
+
width: 64px;
|
|
352
|
+
height: 64px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.RewardReminder_qrHint__1gewp7n14 {
|
|
356
|
+
color: #4b5563;
|
|
357
|
+
flex: 1;
|
|
358
|
+
font-size: 13px;
|
|
359
|
+
line-height: 17px;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.RewardReminder_qrHintExpanded__1gewp7n15 {
|
|
363
|
+
flex: none;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.RewardReminder_later__1gewp7n16 {
|
|
367
|
+
color: #6b7280;
|
|
368
|
+
flex-shrink: 0;
|
|
369
|
+
padding: 8px;
|
|
370
|
+
font-size: 14px;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
@media (prefers-reduced-motion: reduce) {
|
|
374
|
+
.RewardReminder_pillRow__1gewp7n8, .RewardReminder_card__1gewp7nf, .RewardReminder_eyebrowIcon__1gewp7ni, .RewardReminder_tile__1gewp7nm {
|
|
375
|
+
animation: none;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.RewardReminder_qrImage__1gewp7n11 {
|
|
379
|
+
transition: none;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
`;
|
|
383
|
+
// src/components/RewardReminder/RewardReminder.css.ts
|
|
384
|
+
var amount = "RewardReminder_amount__1gewp7nk RewardReminder_box__1gewp7n3";
|
|
385
|
+
var card = "RewardReminder_card__1gewp7nf RewardReminder_box__1gewp7n3";
|
|
386
|
+
var cardHeader = "RewardReminder_cardHeader__1gewp7ng RewardReminder_box__1gewp7n3";
|
|
387
|
+
var close = "RewardReminder_close__1gewp7nr RewardReminder_control__1gewp7n4 RewardReminder_box__1gewp7n3";
|
|
388
|
+
var cta = "RewardReminder_cta__1gewp7nu RewardReminder_control__1gewp7n4 RewardReminder_box__1gewp7n3";
|
|
389
|
+
var dismiss = "RewardReminder_dismiss__1gewp7ne RewardReminder_control__1gewp7n4 RewardReminder_box__1gewp7n3";
|
|
390
|
+
var eyebrow = "RewardReminder_eyebrow__1gewp7nh RewardReminder_box__1gewp7n3";
|
|
391
|
+
var eyebrowIcon = "RewardReminder_eyebrowIcon__1gewp7ni";
|
|
392
|
+
var footer = "RewardReminder_footer__1gewp7nw RewardReminder_box__1gewp7n3";
|
|
393
|
+
var footerQr = "RewardReminder_footerQr__1gewp7nx RewardReminder_box__1gewp7n3";
|
|
394
|
+
var free = "RewardReminder_free__1gewp7nv RewardReminder_box__1gewp7n3";
|
|
395
|
+
var head = "RewardReminder_head__1gewp7nj RewardReminder_box__1gewp7n3";
|
|
396
|
+
var icon = "RewardReminder_icon__1gewp7nb";
|
|
397
|
+
var later = "RewardReminder_later__1gewp7n16 RewardReminder_control__1gewp7n4 RewardReminder_box__1gewp7n3";
|
|
398
|
+
var pill = "RewardReminder_pill__1gewp7na RewardReminder_control__1gewp7n4 RewardReminder_box__1gewp7n3";
|
|
399
|
+
var pillAmount = "RewardReminder_pillAmount__1gewp7nc";
|
|
400
|
+
var pillRow = "RewardReminder_pillRow__1gewp7n8 RewardReminder_box__1gewp7n3";
|
|
401
|
+
var pillRowUrgent = "RewardReminder_pillRowUrgent__1gewp7n9";
|
|
402
|
+
var qrButton = "RewardReminder_qrButton__1gewp7nz RewardReminder_control__1gewp7n4 RewardReminder_box__1gewp7n3";
|
|
403
|
+
var qrHint = "RewardReminder_qrHint__1gewp7n14 RewardReminder_box__1gewp7n3";
|
|
404
|
+
var qrImage = "RewardReminder_qrImage__1gewp7n11";
|
|
405
|
+
var qrPlaceholder = "RewardReminder_qrPlaceholder__1gewp7n13 RewardReminder_box__1gewp7n3";
|
|
406
|
+
var root = "RewardReminder_root__1gewp7n5 RewardReminder_box__1gewp7n3";
|
|
407
|
+
var sideLeft = "RewardReminder_sideLeft__1gewp7n6";
|
|
408
|
+
var sideRight = "RewardReminder_sideRight__1gewp7n7";
|
|
409
|
+
var tile = "RewardReminder_tile__1gewp7nm RewardReminder_box__1gewp7n3";
|
|
410
|
+
var tileNumber = "RewardReminder_tileNumber__1gewp7no";
|
|
411
|
+
var tileUnit = "RewardReminder_tileUnit__1gewp7nq";
|
|
412
|
+
var tileWord = "RewardReminder_tileWord__1gewp7np";
|
|
413
|
+
const cssSource = cssSource$1;
|
|
414
|
+
const classes = (...names) => names.filter(Boolean).join(" ");
|
|
415
|
+
function readBrand() {
|
|
416
|
+
return sdkConfigStore.getConfig().name || window.FrakSetup?.config?.metadata?.name || window.location.hostname;
|
|
417
|
+
}
|
|
418
|
+
function deadlineTemplate(days, copy) {
|
|
419
|
+
if (days <= 0) return copy.deadlineToday;
|
|
420
|
+
if (days === 1) return copy.deadlineOneDay;
|
|
421
|
+
return copy.deadlineDays;
|
|
422
|
+
}
|
|
423
|
+
function parseDate(iso) {
|
|
424
|
+
const date = iso ? new Date(iso) : void 0;
|
|
425
|
+
return date && !Number.isNaN(date.getTime()) ? date : void 0;
|
|
426
|
+
}
|
|
427
|
+
function unlockNoteText(pending, copy, lang) {
|
|
428
|
+
const date = pending.lockedCount > 0 ? parseDate(pending.nextUnlockAt) : void 0;
|
|
429
|
+
if (!date) return void 0;
|
|
430
|
+
const template = pending.lockedCount >= pending.count ? copy.unlockNoteAll : copy.unlockNote;
|
|
431
|
+
return fillReminderText(template, { date: formatRewardDate(date, lang) });
|
|
432
|
+
}
|
|
433
|
+
function breakdownText(pending, copy) {
|
|
434
|
+
const currency = resolveRewardCurrency();
|
|
435
|
+
if (pickFiat(pending.cashback, currency) === 0 || pickFiat(pending.fromFriends, currency) === 0) return;
|
|
436
|
+
return [fillReminderText(copy.breakdownCashback, { reward: formatFiat(pending.cashback, currency) }), fillReminderText(copy.breakdownFromFriends, { reward: formatFiat(pending.fromFriends, currency) })].join(" · ");
|
|
437
|
+
}
|
|
438
|
+
function DayTile({ days, copy }) {
|
|
439
|
+
return /* @__PURE__ */ jsx("p", {
|
|
440
|
+
class: classes(tile, days <= 3 && "RewardReminder_tileUrgent__1gewp7nn"),
|
|
441
|
+
children: days <= 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
442
|
+
/* @__PURE__ */ jsx("span", {
|
|
443
|
+
class: tileWord,
|
|
444
|
+
children: copy.tileLastDay
|
|
445
|
+
}),
|
|
446
|
+
" ",
|
|
447
|
+
/* @__PURE__ */ jsx("span", {
|
|
448
|
+
class: tileUnit,
|
|
449
|
+
children: copy.tileLastDayUnit
|
|
450
|
+
})
|
|
451
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
452
|
+
/* @__PURE__ */ jsx("span", {
|
|
453
|
+
class: tileNumber,
|
|
454
|
+
children: days
|
|
455
|
+
}),
|
|
456
|
+
" ",
|
|
457
|
+
/* @__PURE__ */ jsx("span", {
|
|
458
|
+
class: tileUnit,
|
|
459
|
+
children: days === 1 ? copy.tileOneDay : copy.tileDays
|
|
460
|
+
})
|
|
461
|
+
] })
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
/** Desktop gets a small QR that a click enlarges to a scannable size; phones only get Later. */
|
|
465
|
+
function CardFooter({ copy, installUrl, onLater }) {
|
|
466
|
+
const desktop = !isMobile();
|
|
467
|
+
const { wide, grid } = useInstallQr(desktop ? installUrl : void 0);
|
|
468
|
+
const [expanded, setExpanded] = useState(false);
|
|
469
|
+
const laterButton = /* @__PURE__ */ jsx("button", {
|
|
470
|
+
type: "button",
|
|
471
|
+
class: later,
|
|
472
|
+
onClick: onLater,
|
|
473
|
+
children: copy.later
|
|
474
|
+
});
|
|
475
|
+
if (!desktop || !wide || !installUrl) return /* @__PURE__ */ jsx("div", {
|
|
476
|
+
class: footer,
|
|
477
|
+
children: laterButton
|
|
478
|
+
});
|
|
479
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
480
|
+
class: classes(footer, footerQr, expanded && "RewardReminder_footerQrExpanded__1gewp7ny RewardReminder_box__1gewp7n3"),
|
|
481
|
+
children: [
|
|
482
|
+
grid ? /* @__PURE__ */ jsx("button", {
|
|
483
|
+
type: "button",
|
|
484
|
+
class: classes(qrButton, expanded && "RewardReminder_qrButtonExpanded__1gewp7n10"),
|
|
485
|
+
"aria-expanded": expanded,
|
|
486
|
+
onClick: () => setExpanded((open) => !open),
|
|
487
|
+
children: /* @__PURE__ */ jsx(QrSvg, {
|
|
488
|
+
grid,
|
|
489
|
+
label: copy.qrLabel,
|
|
490
|
+
class: classes(qrImage, expanded && "RewardReminder_qrImageExpanded__1gewp7n12")
|
|
491
|
+
})
|
|
492
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
493
|
+
class: qrPlaceholder,
|
|
494
|
+
"aria-hidden": "true"
|
|
495
|
+
}),
|
|
496
|
+
/* @__PURE__ */ jsx("p", {
|
|
497
|
+
class: classes(qrHint, expanded && "RewardReminder_qrHintExpanded__1gewp7n15"),
|
|
498
|
+
children: expanded ? copy.qrCaption : copy.qrHint
|
|
499
|
+
}),
|
|
500
|
+
laterButton
|
|
501
|
+
]
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
function ClaimAnchor({ installUrl, isPreview, onClaim, children }) {
|
|
505
|
+
const inert = !isPreview && !installUrl;
|
|
506
|
+
return /* @__PURE__ */ jsx("a", {
|
|
507
|
+
class: cta,
|
|
508
|
+
href: isPreview ? "#" : installUrl,
|
|
509
|
+
target: isPreview ? void 0 : "_blank",
|
|
510
|
+
rel: "noopener",
|
|
511
|
+
role: inert ? "link" : void 0,
|
|
512
|
+
tabIndex: inert ? 0 : void 0,
|
|
513
|
+
"aria-disabled": inert ? "true" : void 0,
|
|
514
|
+
onClick: onClaim,
|
|
515
|
+
children
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
/** The expanded half of the reminder: amount, days left, claim link and, on desktop, an enlargeable install QR. */
|
|
519
|
+
function ReminderCard({ id, titleId, cardRef, lang, pending, countdown, installUrl, isPreview, texts, onClose, onClaim, onLater }) {
|
|
520
|
+
const amountId = useId();
|
|
521
|
+
const copy = componentDefaults[lang].rewardReminder;
|
|
522
|
+
const days = countdown?.days;
|
|
523
|
+
const values = {
|
|
524
|
+
reward: formatFiat(pending.total, resolveRewardCurrency()),
|
|
525
|
+
days,
|
|
526
|
+
date: countdown ? formatRewardDate(countdown.date, lang) : void 0,
|
|
527
|
+
brand: readBrand()
|
|
528
|
+
};
|
|
529
|
+
const split = breakdownText(pending, copy);
|
|
530
|
+
const deadlineLine = [days === void 0 ? void 0 : fillReminderText(deadlineTemplate(days, copy), values), unlockNoteText(pending, copy, lang)].filter(Boolean).join(" ");
|
|
531
|
+
const urgent = days !== void 0 && days <= 3;
|
|
532
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
533
|
+
ref: cardRef,
|
|
534
|
+
id,
|
|
535
|
+
class: card,
|
|
536
|
+
role: "dialog",
|
|
537
|
+
"aria-labelledby": `${titleId} ${amountId}`,
|
|
538
|
+
tabIndex: -1,
|
|
539
|
+
children: [
|
|
540
|
+
/* @__PURE__ */ jsxs("div", {
|
|
541
|
+
class: cardHeader,
|
|
542
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
543
|
+
id: titleId,
|
|
544
|
+
class: eyebrow,
|
|
545
|
+
children: [/* @__PURE__ */ jsx(GiftIcon, {
|
|
546
|
+
class: eyebrowIcon,
|
|
547
|
+
ink: "#111827"
|
|
548
|
+
}), fillReminderText(texts.title || copy.title, values)]
|
|
549
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
550
|
+
type: "button",
|
|
551
|
+
class: close,
|
|
552
|
+
"aria-label": copy.closeLabel,
|
|
553
|
+
onClick: onClose,
|
|
554
|
+
children: "×"
|
|
555
|
+
})]
|
|
556
|
+
}),
|
|
557
|
+
/* @__PURE__ */ jsxs("div", {
|
|
558
|
+
class: head,
|
|
559
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
560
|
+
id: amountId,
|
|
561
|
+
class: amount,
|
|
562
|
+
children: values.reward
|
|
563
|
+
}), split && /* @__PURE__ */ jsx("p", {
|
|
564
|
+
class: "RewardReminder_breakdown__1gewp7nl RewardReminder_box__1gewp7n3",
|
|
565
|
+
children: split
|
|
566
|
+
})] }), days !== void 0 && /* @__PURE__ */ jsx(DayTile, {
|
|
567
|
+
days,
|
|
568
|
+
copy
|
|
569
|
+
})]
|
|
570
|
+
}),
|
|
571
|
+
deadlineLine && /* @__PURE__ */ jsx("p", {
|
|
572
|
+
class: classes("RewardReminder_deadline__1gewp7ns RewardReminder_box__1gewp7n3", urgent && "RewardReminder_deadlineUrgent__1gewp7nt"),
|
|
573
|
+
children: deadlineLine
|
|
574
|
+
}),
|
|
575
|
+
/* @__PURE__ */ jsx(ClaimAnchor, {
|
|
576
|
+
installUrl,
|
|
577
|
+
isPreview,
|
|
578
|
+
onClaim,
|
|
579
|
+
children: fillReminderText(texts.cta || copy.cta, values)
|
|
580
|
+
}),
|
|
581
|
+
/* @__PURE__ */ jsx("p", {
|
|
582
|
+
class: free,
|
|
583
|
+
children: fillReminderText(texts.description || copy.description, values)
|
|
584
|
+
}),
|
|
585
|
+
/* @__PURE__ */ jsx(CardFooter, {
|
|
586
|
+
copy,
|
|
587
|
+
installUrl,
|
|
588
|
+
onLater
|
|
589
|
+
})
|
|
590
|
+
]
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
// src/rewards/reminderConfig.ts
|
|
594
|
+
/** Either the page's SDK config or the merchant dashboard can switch the floating reminder off. */
|
|
595
|
+
function isRewardReminderEnabled() {
|
|
596
|
+
return window.FrakSetup?.config?.rewardReminder?.enabled !== false && sdkConfigStore.getConfig().components?.rewardReminder?.enabled !== false;
|
|
597
|
+
}
|
|
598
|
+
// src/components/RewardReminder/useRewardReminder.ts
|
|
599
|
+
function readResolved() {
|
|
600
|
+
return sdkConfigStore.isResolved;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Everything the pill needs to know before it draws: whether it may show, the
|
|
604
|
+
* rewards behind it, the prefetched install link and the analytics funnel.
|
|
605
|
+
* `null` while hidden.
|
|
606
|
+
*/
|
|
607
|
+
function useRewardReminder(isPreview, placement) {
|
|
608
|
+
const { shouldRender, isHidden, isClientReady } = useClientReady();
|
|
609
|
+
const isResolved = useSyncExternalStore(subscribeSdkConfig, readResolved);
|
|
610
|
+
const dismissed = useReminderDismissed();
|
|
611
|
+
const hasInline = useHasInlineReminder();
|
|
612
|
+
const active = isClientReady && shouldRender && isResolved && !isHidden && isRewardReminderEnabled();
|
|
613
|
+
const { summary } = useRewardSummary(active && !isPreview);
|
|
614
|
+
const previewPending = useMemo(() => getPreviewPending(), []);
|
|
615
|
+
const claimable = isClaimable(summary) ? summary.pending : null;
|
|
616
|
+
const pending = isPreview ? previewPending : claimable;
|
|
617
|
+
const visible = isPreview || active && !!pending && !dismissed && !hasInline;
|
|
618
|
+
const countdown = useMemo(() => getRewardCountdown(pending?.expiresAt ?? null), [pending?.expiresAt]);
|
|
619
|
+
const [installUrl, setInstallUrl] = useState(void 0);
|
|
620
|
+
const trackedImpressionRef = useRef(false);
|
|
621
|
+
const daysLeft = countdown?.days;
|
|
622
|
+
const locked = (pending?.lockedCount ?? 0) > 0;
|
|
623
|
+
const track = useCallback((event) => {
|
|
624
|
+
if (isPreview) return;
|
|
625
|
+
trackEvent(window.FrakSetup?.client, event, {
|
|
626
|
+
surface: "pill",
|
|
627
|
+
placement,
|
|
628
|
+
days_left: daysLeft,
|
|
629
|
+
locked
|
|
630
|
+
});
|
|
631
|
+
}, [
|
|
632
|
+
isPreview,
|
|
633
|
+
placement,
|
|
634
|
+
daysLeft,
|
|
635
|
+
locked
|
|
636
|
+
]);
|
|
637
|
+
useEffect(() => {
|
|
638
|
+
if (!visible || trackedImpressionRef.current) return;
|
|
639
|
+
trackedImpressionRef.current = true;
|
|
640
|
+
track("reward_reminder_impression");
|
|
641
|
+
}, [visible, track]);
|
|
642
|
+
useEffect(() => {
|
|
643
|
+
if (!visible || isPreview) return;
|
|
644
|
+
let cancelled = false;
|
|
645
|
+
getInstallUrl().then((url) => {
|
|
646
|
+
if (!cancelled) setInstallUrl(url);
|
|
647
|
+
}).catch(() => {});
|
|
648
|
+
return () => {
|
|
649
|
+
cancelled = true;
|
|
650
|
+
};
|
|
651
|
+
}, [visible, isPreview]);
|
|
652
|
+
if (!visible || !pending) return null;
|
|
653
|
+
return {
|
|
654
|
+
pending,
|
|
655
|
+
countdown,
|
|
656
|
+
installUrl,
|
|
657
|
+
track
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
// src/components/RewardReminder/RewardReminder.tsx
|
|
661
|
+
function isSide(value) {
|
|
662
|
+
return value === "left" || value === "right";
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Floating pill for a visitor with unclaimed rewards and no Frak wallet, expanding into a claim card.
|
|
666
|
+
* Snoozed for the browser session once dismissed.
|
|
667
|
+
*
|
|
668
|
+
* @group components
|
|
669
|
+
*/
|
|
670
|
+
function RewardReminder({ placement, classname = "", position: positionProp, heading: headingProp, description: descriptionProp, cta: ctaProp, preview }) {
|
|
671
|
+
const isPreview = !!preview;
|
|
672
|
+
const lang = useLang();
|
|
673
|
+
const config = useGlobalComponents()?.rewardReminder;
|
|
674
|
+
const model = useRewardReminder(isPreview, placement);
|
|
675
|
+
const track = model?.track;
|
|
676
|
+
const claimUrl = model?.installUrl;
|
|
677
|
+
const [expanded, setExpanded] = useState(false);
|
|
678
|
+
const pillRef = useRef(null);
|
|
679
|
+
const cardRef = useRef(null);
|
|
680
|
+
const cardId = useId();
|
|
681
|
+
const titleId = useId();
|
|
682
|
+
useEffect(() => {
|
|
683
|
+
if (expanded) cardRef.current?.focus();
|
|
684
|
+
}, [expanded]);
|
|
685
|
+
const collapse = useCallback(() => {
|
|
686
|
+
setExpanded(false);
|
|
687
|
+
pillRef.current?.focus();
|
|
688
|
+
}, []);
|
|
689
|
+
const onPillClick = useCallback(() => {
|
|
690
|
+
if (expanded) {
|
|
691
|
+
collapse();
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
setExpanded(true);
|
|
695
|
+
track?.("reward_reminder_opened");
|
|
696
|
+
}, [
|
|
697
|
+
expanded,
|
|
698
|
+
collapse,
|
|
699
|
+
track
|
|
700
|
+
]);
|
|
701
|
+
const onDismiss = useCallback(() => {
|
|
702
|
+
track?.("reward_reminder_dismissed");
|
|
703
|
+
if (!isPreview) dismissReminder();
|
|
704
|
+
}, [track, isPreview]);
|
|
705
|
+
const onClaim = useCallback((event) => {
|
|
706
|
+
if (isPreview) return;
|
|
707
|
+
if (!claimUrl) {
|
|
708
|
+
event.preventDefault();
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
markClaimStarted();
|
|
712
|
+
track?.("reward_reminder_claim_clicked");
|
|
713
|
+
}, [
|
|
714
|
+
isPreview,
|
|
715
|
+
claimUrl,
|
|
716
|
+
track
|
|
717
|
+
]);
|
|
718
|
+
const onKeyDown = useCallback((event) => {
|
|
719
|
+
if (event.key === "Escape" && expanded) {
|
|
720
|
+
event.stopPropagation();
|
|
721
|
+
collapse();
|
|
722
|
+
}
|
|
723
|
+
}, [expanded, collapse]);
|
|
724
|
+
if (!model) return null;
|
|
725
|
+
const { pending, countdown, installUrl } = model;
|
|
726
|
+
const copy = componentDefaults[lang].rewardReminder;
|
|
727
|
+
const reward = formatFiat(pending.total, resolveRewardCurrency());
|
|
728
|
+
const days = countdown?.days;
|
|
729
|
+
const countdownLabel = days === void 0 ? void 0 : getCountdownLabel(days, lang);
|
|
730
|
+
const pillLabel = [fillReminderText(copy.pillLabel, { reward }), countdownLabel].filter(Boolean).join(", ");
|
|
731
|
+
const side = [
|
|
732
|
+
positionProp,
|
|
733
|
+
config?.position,
|
|
734
|
+
window.FrakSetup?.config?.rewardReminder?.position
|
|
735
|
+
].find(isSide);
|
|
736
|
+
const urgent = days !== void 0 && days <= 3;
|
|
737
|
+
const rootClass = [
|
|
738
|
+
root,
|
|
739
|
+
side === "right" ? sideRight : sideLeft,
|
|
740
|
+
"frak-reward-reminder",
|
|
741
|
+
classname
|
|
742
|
+
].filter(Boolean).join(" ");
|
|
743
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("style", { children: buildStyleContent(cssSource, config?.css) }), /* @__PURE__ */ jsxs("div", {
|
|
744
|
+
class: rootClass,
|
|
745
|
+
part: "root",
|
|
746
|
+
onKeyDown,
|
|
747
|
+
children: [expanded && /* @__PURE__ */ jsx(ReminderCard, {
|
|
748
|
+
id: cardId,
|
|
749
|
+
titleId,
|
|
750
|
+
cardRef,
|
|
751
|
+
lang,
|
|
752
|
+
pending,
|
|
753
|
+
countdown,
|
|
754
|
+
installUrl,
|
|
755
|
+
isPreview,
|
|
756
|
+
texts: {
|
|
757
|
+
title: headingProp || config?.title,
|
|
758
|
+
description: descriptionProp || config?.description,
|
|
759
|
+
cta: ctaProp || config?.cta
|
|
760
|
+
},
|
|
761
|
+
onClose: collapse,
|
|
762
|
+
onClaim,
|
|
763
|
+
onLater: onDismiss
|
|
764
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
765
|
+
class: urgent ? `${pillRow} ${pillRowUrgent}` : pillRow,
|
|
766
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
767
|
+
ref: pillRef,
|
|
768
|
+
type: "button",
|
|
769
|
+
class: pill,
|
|
770
|
+
part: "pill",
|
|
771
|
+
"aria-expanded": expanded,
|
|
772
|
+
"aria-controls": expanded ? cardId : void 0,
|
|
773
|
+
"aria-label": pillLabel,
|
|
774
|
+
onClick: onPillClick,
|
|
775
|
+
children: [
|
|
776
|
+
/* @__PURE__ */ jsx(GiftIcon, {
|
|
777
|
+
class: icon,
|
|
778
|
+
ink: "#fff"
|
|
779
|
+
}),
|
|
780
|
+
/* @__PURE__ */ jsx("span", {
|
|
781
|
+
class: pillAmount,
|
|
782
|
+
children: reward
|
|
783
|
+
}),
|
|
784
|
+
countdownLabel && /* @__PURE__ */ jsx("span", {
|
|
785
|
+
class: "RewardReminder_pillCountdown__1gewp7nd",
|
|
786
|
+
children: countdownLabel
|
|
787
|
+
})
|
|
788
|
+
]
|
|
789
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
790
|
+
type: "button",
|
|
791
|
+
class: dismiss,
|
|
792
|
+
"aria-label": copy.dismissLabel,
|
|
793
|
+
onClick: onDismiss,
|
|
794
|
+
children: "×"
|
|
795
|
+
})]
|
|
796
|
+
})]
|
|
797
|
+
})] });
|
|
798
|
+
}
|
|
799
|
+
// src/components/RewardReminder/index.ts
|
|
800
|
+
registerWebComponent(RewardReminder, "frak-reward-reminder", [
|
|
801
|
+
"placement",
|
|
802
|
+
"classname",
|
|
803
|
+
"position",
|
|
804
|
+
"heading",
|
|
805
|
+
"description",
|
|
806
|
+
"cta",
|
|
807
|
+
"preview"
|
|
808
|
+
], { shadow: true });
|
|
809
|
+
export { RewardReminder };
|