fansunited-frontend-components 0.0.97 → 0.0.99

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 (69) hide show
  1. package/Betslip.js +2 -2
  2. package/ChanceGame.js +958 -1464
  3. package/ClassicQuizPlay.js +2 -2
  4. package/CollectLead.js +1 -1
  5. package/CompetitionStatistics.js +2042 -2215
  6. package/CompetitorCard.js +4281 -4919
  7. package/Discussion.js +2 -2
  8. package/EitherOrPlay.js +2 -2
  9. package/EventCard.js +6010 -7547
  10. package/EventGamePlay.js +2 -2
  11. package/Leaderboard.js +546 -849
  12. package/List.js +227 -218
  13. package/MatchQuizPlay.js +2 -2
  14. package/Odds.js +50 -42
  15. package/PersonalityQuizPlay.js +2 -2
  16. package/PickThePair.js +2 -2
  17. package/PlayerOfTheMatch.js +285 -269
  18. package/PollVote.js +2 -2
  19. package/Predictor.js +80 -127
  20. package/README.md +1 -1
  21. package/Standings.js +991 -1324
  22. package/TopX.js +1120 -1167
  23. package/chunks/{ChanceGameEmbedVariant-CVys-3Zh.js → ChanceGameEmbedVariant-DM9eLG5s.js} +2 -2
  24. package/chunks/CheckCircle-I1FktW5Y.js +13 -0
  25. package/chunks/OddsSkeleton-DP5Yfqpr.js +522 -0
  26. package/chunks/Person-CXRqyF4E.js +11 -0
  27. package/chunks/PickOneOfX-DET4ZhjV.js +3117 -0
  28. package/chunks/Search-CIXthh0D.js +17 -0
  29. package/chunks/TimerOutlined-D-WA_vpE.js +8 -0
  30. package/chunks/WorkspacePremiumOutlined-DUXVgJlF.js +136 -0
  31. package/chunks/{chevrons-right-CXSpQt9w.js → chevrons-right-HWKW2c4I.js} +24 -4
  32. package/chunks/index-BENM3N_w.js +4 -0
  33. package/chunks/index-BRxAV693.js +4 -0
  34. package/chunks/index-BXYTsvIX.js +4 -0
  35. package/chunks/index-C0ilols1.js +4 -0
  36. package/chunks/index-D7VhczXH.js +4 -0
  37. package/chunks/index-DKwvdw9t.js +4 -0
  38. package/chunks/index-DZN-AITW.js +4 -0
  39. package/chunks/main-B2sDRFF4.js +2184 -0
  40. package/chunks/main-CzfWaEQP.js +4869 -0
  41. package/chunks/main-DFNl3g_U.js +4910 -0
  42. package/chunks/{main-65WcUqAl.js → main-DLwnvntz.js} +600 -593
  43. package/chunks/main-DiBlJBNb.js +1956 -0
  44. package/chunks/main-DxvBjXsd.js +1775 -0
  45. package/chunks/main-S8_NDSiY.js +3209 -0
  46. package/chunks/main-lBgr8Liq.js +6571 -0
  47. package/chunks/{withVersionStamp-BkiEu_79.js → withVersionStamp-BsLyhvNA.js} +1 -1
  48. package/package.json +2 -2
  49. package/chunks/OddsSkeleton-ClJE2xhR.js +0 -26
  50. package/chunks/OddsStrip-BnSp5TXa.js +0 -383
  51. package/chunks/PickOneOfX-DaJtkbCw.js +0 -4206
  52. package/chunks/chevron-left-CxfCSZcr.js +0 -13
  53. package/chunks/chevron-right-BEQMacFn.js +0 -13
  54. package/chunks/index-Aq5MbUB9.js +0 -4
  55. package/chunks/index-BBQm_8LD.js +0 -4
  56. package/chunks/index-BC_sWWgc.js +0 -4
  57. package/chunks/index-DXKDJ1Vp.js +0 -4
  58. package/chunks/index-DjT5NrbA.js +0 -4
  59. package/chunks/index-DvLRehH6.js +0 -4
  60. package/chunks/index-aIMaxR-p.js +0 -4
  61. package/chunks/main-52Wff7qC.js +0 -11441
  62. package/chunks/main-B58mi9jx.js +0 -5622
  63. package/chunks/main-BIdXUTZS.js +0 -7308
  64. package/chunks/main-DD-NEzC7.js +0 -8241
  65. package/chunks/main-DUnfJPzY.js +0 -3608
  66. package/chunks/main-DpCBqqg_.js +0 -1950
  67. package/chunks/main-Drznt1ak.js +0 -1790
  68. package/chunks/users-wbJRbqW8.js +0 -16
  69. package/chunks/x-CK4GYo7T.js +0 -14
@@ -1,3608 +0,0 @@
1
- import { jsx as t, jsxs as x, Fragment as v } from "react/jsx-runtime";
2
- import { useDisableCache as gt, getTranslatedPollIds as rt, useFontFamily as fe, isTablet as It, isMobile as Q, getBrandingClickUrl as Pt, CollectLeadForm as Tt, useInternalTheme as ve, useColors as D, useCornerRadius as re, useSpacingScale as Te, useBorderSize as $e, useEmbedCode as Ye, useConstantContext as Fe, ConstantsContext as Be, isLarge as Me, extractBrandingModelProperties as Qe, defaultBgVertical as Ve, defaultBg as ze, useImageVariant as Ue, WidgetTemplate as G, OverlaySkeleton as At, ConsentPanel as Ee, ConsentCta as _e, SignInCta as Ge, isExtraSmall as vt, hexToRgb as De, StandardSkeleton as Lt, useImageBackgroundGradient as mt, SplitSkeleton as kt, stripHtmlTags as wt, useIntlLocale as ut, StandardScoreStateSkeleton as Dt, AdditionalCTA as pe, isDesktop as Rt, SplitScoreStateSkeleton as Ft, sanitizeBackgroundUrl as Bt, OverlayScoreStateSkeleton as Vt, NotFoundSkeleton as zt, OverlayApiErrorSkeleton as ft, SplitApiErrorSkeleton as xt, StandardApiErrorSkeleton as yt, StandardLeadAfterCollection as ht, SplitLeadAfterCollection as bt, OverlayLeadAfterCollection as Ct, getRelatedInfoPageId as Ut, useConsents as Et, initializeI18n as Wt, Spinner as Ot, ChanceGameEmbed as ct, extractSdkError as qt, Portal as jt } from "fansunited-frontend-core";
3
- import { C as st } from "./ChanceGameEmbedVariant-CVys-3Zh.js";
4
- import Re, { useState as U, useEffect as ke, useCallback as Mt, useRef as Ht, useMemo as Ke } from "react";
5
- import { PollFullModel as Gt, SinglePollVoteModel as Nt } from "fansunited-sdk-esm/models";
6
- import { Box as i, Typography as L, AspectRatio as Ne, Button as He, Alert as $t, Stack as Yt } from "@mui/joy";
7
- import { useTranslation as O } from "react-i18next";
8
- import et from "@mui/icons-material/Replay";
9
- import Qt from "@mui/icons-material/CheckCircle";
10
- import _t from "@mui/icons-material/Info";
11
- import Kt from "@mui/icons-material/Warning";
12
- import je from "@mui/icons-material/People";
13
- const Jt = (e, n) => {
14
- const [a, l] = U(null), o = gt(), c = async () => {
15
- try {
16
- const r = await n.voting.getPollById(e, o);
17
- l(r);
18
- } catch (r) {
19
- console.error(r), l(new Gt());
20
- }
21
- };
22
- return ke(() => (c(), () => l(null)), [e, n, o]), { poll: a, setPoll: l };
23
- }, Xt = (e, n, a, l = !1, o = !1) => {
24
- const [c, r] = U(null), [u, f] = U(!1), [m, d] = U(!1), [s, h] = U(""), [A, P] = U(a);
25
- a !== A && (P(a), r(null));
26
- const S = async () => {
27
- try {
28
- const B = await n.voting.getMyPollVote(e);
29
- r(B);
30
- } catch (b) {
31
- if (r(new Nt()), n.helpers.getSDKConfiguration().errorHandlingMode === "standard") {
32
- const R = b;
33
- if (R.error.code === 404)
34
- return;
35
- if (R.error.code === 401 || R.error.code === 403) {
36
- l || f(!0);
37
- return;
38
- }
39
- d(!0), h(R.error.message);
40
- return;
41
- }
42
- const C = b;
43
- if (C.data.error.code === 404)
44
- return;
45
- if (C.data.error.code === 401 || C.data.error.code === 403) {
46
- l || f(!0);
47
- return;
48
- }
49
- d(!0), h(C.data.error.message);
50
- }
51
- };
52
- return ke(() => (S(), () => {
53
- r(null), f(!1), d(!1);
54
- }), [e, n, a, l, o]), {
55
- myVote: c,
56
- setMyVote: r,
57
- isUnauthorized: u,
58
- isApiError: m,
59
- apiErrorMessage: s,
60
- setIsUnauthorized: f,
61
- setIsApiError: d,
62
- setApiErrorMessage: h
63
- };
64
- }, dt = async (e, n, a) => {
65
- if (!n.length) return [];
66
- const l = await e.voting.getPolls(
67
- { pollIds: n, limit: n.length },
68
- a
69
- );
70
- return (l == null ? void 0 : l.data) || [];
71
- }, Zt = async (e, n, a = !1) => {
72
- const l = /* @__PURE__ */ new Set([e.id]), o = (m) => m.filter((d) => !l.has(d)), c = o(rt(e.related));
73
- c.forEach((m) => l.add(m));
74
- const r = await dt(n, c, a), u = o(
75
- Array.from(new Set(r.flatMap((m) => rt(m.related))))
76
- ), f = await dt(n, u, a);
77
- return [...r, ...f];
78
- }, pt = (e, n) => {
79
- const a = n.filter((l) => {
80
- var o;
81
- return ((o = l.options) == null ? void 0 : o.length) === e.length ? !0 : (console.warn(
82
- `[poll-vote] translated poll ${l.id} has a different number of options, its votes are not aggregated`
83
- ), !1);
84
- });
85
- return e.map((l, o) => ({
86
- ...l,
87
- votes: a.reduce(
88
- (c, r) => c + (r.options[o].votes || 0),
89
- l.votes || 0
90
- )
91
- }));
92
- }, en = (e, n) => {
93
- const [a, l] = U([]), [o, c] = U(!1), r = gt(), u = Mt(async () => {
94
- if (e != null && e.id)
95
- try {
96
- l(await Zt(e, n, r));
97
- } catch (f) {
98
- console.error("[poll-vote] translated polls could not be loaded", f), l([]);
99
- } finally {
100
- c(!0);
101
- }
102
- }, [e, n, r]);
103
- return { translations: a, loaded: o, loadTranslations: u };
104
- }, W = (e) => {
105
- const n = fe().secondary, a = It(), l = e.isSplitVariant && a, o = Q(), c = Pt(e.primaryUrl, e.secondaryUrl, "logo");
106
- if (!e.brandingLogo)
107
- return null;
108
- const r = () => {
109
- c && window.open(c, "_blank", "noopener,noreferrer");
110
- }, u = /* @__PURE__ */ t(
111
- "img",
112
- {
113
- src: e.brandingLogo,
114
- alt: "branding-logo",
115
- style: {
116
- maxHeight: "50px",
117
- maxWidth: "100px"
118
- }
119
- }
120
- ), f = c ? typeof window > "u" ? /* @__PURE__ */ t(
121
- i,
122
- {
123
- component: "a",
124
- href: c,
125
- target: "_blank",
126
- rel: "noopener noreferrer",
127
- sx: {
128
- cursor: "pointer",
129
- textDecoration: "none",
130
- display: "inline-flex"
131
- },
132
- children: u
133
- }
134
- ) : /* @__PURE__ */ t(
135
- i,
136
- {
137
- onClick: r,
138
- sx: {
139
- cursor: "pointer",
140
- display: "inline-flex"
141
- },
142
- children: u
143
- }
144
- ) : u;
145
- return e.isCentered || l || o ? /* @__PURE__ */ x(
146
- i,
147
- {
148
- sx: {
149
- display: "flex",
150
- flexDirection: "column",
151
- gap: "8px",
152
- alignItems: "center",
153
- minWidth: "180px",
154
- fontSize: "1em",
155
- zIndex: 1
156
- },
157
- children: [
158
- e.label && /* @__PURE__ */ t(
159
- L,
160
- {
161
- level: "body-sm",
162
- sx: {
163
- fontWeight: 400,
164
- lineHeight: "166%",
165
- letterSpacing: "0.4px",
166
- fontSize: "1em",
167
- color: e.textColor,
168
- textAlign: "right",
169
- fontFamily: n
170
- },
171
- children: e.label
172
- }
173
- ),
174
- f
175
- ]
176
- }
177
- ) : /* @__PURE__ */ x(
178
- i,
179
- {
180
- sx: {
181
- minWidth: "180px",
182
- display: "flex",
183
- gap: "8px",
184
- alignItems: "center",
185
- zIndex: 10,
186
- fontSize: "1em"
187
- },
188
- children: [
189
- e.label && /* @__PURE__ */ t(
190
- L,
191
- {
192
- level: "body-sm",
193
- sx: {
194
- fontWeight: 400,
195
- lineHeight: "166%",
196
- letterSpacing: "0.4px",
197
- textAlign: "right",
198
- fontSize: "1em",
199
- color: e.textColor,
200
- fontFamily: n
201
- },
202
- children: e.label
203
- }
204
- ),
205
- f
206
- ]
207
- }
208
- );
209
- }, We = ({
210
- sdk: e,
211
- contentId: n,
212
- contentName: a,
213
- brandingColors: l,
214
- brandingUrls: o,
215
- campaignId: c,
216
- campaignName: r,
217
- startGame: u,
218
- fields: f = ["fullName", "email"],
219
- leadTitle: m,
220
- leadDescription: d,
221
- leadCta: s,
222
- leadSuccessTitle: h,
223
- leadSuccessDescription: A,
224
- syncWithProfile: P = !1,
225
- consents: S,
226
- isAfterPosition: b = !1,
227
- isSubmittingParticipation: B = !1
228
- }) => {
229
- const { t: C } = O(), R = m ?? C("leads.header.title"), V = d ?? C("leads.header.description"), T = s ?? C("leads.buttons.submit"), y = h ?? C("leads.success.title"), N = A ?? C("leads.success.description"), g = {
230
- defaultLabel: C(b ? "poll.buttons.vote" : "poll.buttons.start"),
231
- onClick: u
232
- };
233
- return /* @__PURE__ */ t(
234
- Tt,
235
- {
236
- sdk: e,
237
- content: {
238
- id: n,
239
- type: "poll",
240
- name: a
241
- },
242
- onSuccessCta: g,
243
- branding: {
244
- colors: l,
245
- urls: o
246
- },
247
- campaign: {
248
- id: c,
249
- name: r
250
- },
251
- fields: f,
252
- labels: {
253
- title: R,
254
- description: V,
255
- submitButtonLabel: T,
256
- successTitle: y,
257
- successDescription: N
258
- },
259
- syncWithProfile: P,
260
- consents: S,
261
- isSubmittingParticipation: B
262
- }
263
- );
264
- }, tn = (e) => ({
265
- // Main content section (non-filter screen)
266
- mainContentSection: {
267
- display: "flex",
268
- flexDirection: "column",
269
- gap: "24px"
270
- },
271
- // Content container with backdrop
272
- contentContainerWithBackdrop: {
273
- borderRadius: e.smBorderRadius,
274
- p: e.spacingScale.md,
275
- display: "flex",
276
- flexDirection: "column",
277
- gap: e.spacingScale.md,
278
- backdropFilter: "blur(4px)",
279
- position: "relative",
280
- "&::before": {
281
- content: '""',
282
- position: "absolute",
283
- top: 0,
284
- left: 0,
285
- right: 0,
286
- bottom: 0,
287
- backgroundColor: e.contentBgColor,
288
- opacity: 0.5,
289
- borderRadius: "inherit",
290
- zIndex: 0
291
- },
292
- "& > *": {
293
- position: "relative",
294
- zIndex: 1
295
- }
296
- },
297
- // Alternative title section
298
- alternativeTitleSection: {
299
- display: "flex",
300
- gap: "8px",
301
- alignItems: "flex-start",
302
- justifyContent: "center"
303
- },
304
- // Alternative title text
305
- alternativeTitleText: {
306
- fontFamily: e.fontFamilyPrimary,
307
- lineHeight: "150%",
308
- letterSpacing: "0.15px",
309
- fontWeight: 500,
310
- fontSize: "1.25em",
311
- textAlign: "center",
312
- color: e.darkTextColor
313
- },
314
- // Bottom footer container
315
- bottomFooterContainer: {
316
- display: "flex",
317
- alignItems: "center",
318
- justifyContent: e.isMobile ? "center" : "space-between",
319
- flexDirection: e.isMobile ? "column-reverse" : "row",
320
- gap: e.spacingScale.md
321
- },
322
- // Next button
323
- nextButton: {
324
- borderRadius: e.buttonRadius,
325
- py: "10px",
326
- px: "16px",
327
- bgcolor: e.primaryColor,
328
- color: e.onPrimaryColor,
329
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
330
- transform: "scale(1)",
331
- ml: e.isMobile ? 0 : { md: "auto" },
332
- "&:hover": {
333
- bgcolor: e.primaryColor,
334
- transform: "scale(1.02)",
335
- boxShadow: "var(--joy-shadow-md)"
336
- },
337
- "&:active": {
338
- color: e.onPrimaryColor,
339
- transform: "scale(0.98)",
340
- boxShadow: "var(--joy-shadow-md)"
341
- },
342
- "&:disabled": {
343
- bgcolor: e.primaryColor,
344
- color: e.onPrimaryColor,
345
- opacity: "34%",
346
- boxShadow: "var(--joy-shadow-md)"
347
- },
348
- "--Icon-color": e.onPrimaryColor,
349
- fontSize: "0.9375em",
350
- boxShadow: "var(--joy-shadow-md)"
351
- },
352
- // Next button text
353
- nextButtonText: {
354
- fontFamily: e.fontFamilyPrimary,
355
- fontWeight: 500,
356
- fontSize: "0.9375em",
357
- lineHeight: "24px",
358
- letterSpacing: "0.46px",
359
- textTransform: "uppercase",
360
- color: e.onPrimaryColor,
361
- gap: "8px",
362
- display: "flex",
363
- alignItems: "center"
364
- }
365
- }), Je = (e) => {
366
- var C;
367
- const n = ve(), a = D(), l = re().sm, o = fe().primary, c = re().xs, r = Te(), u = $e().size, f = Ye(e.option.embedCode || ""), m = !!e.option.embedCode, d = ((C = e.brandingColors) == null ? void 0 : C.primaryColor) || a.palette.primary.plainColor, s = a.palette.primary.onPrimary, h = e.selectedOptions.includes(e.option.id) ? s : n.colorSchemes.light.textColor, A = e.optionsImages.get(e.option.id), P = () => {
368
- e.multipleChoice ? e.answerPoll([e.option.id]) : e.answerPoll([e.option.id]);
369
- }, S = e.selectedOptions.includes(e.option.id), b = e.isVoting || e.disabled || e.multipleChoice && !S && e.selectedOptions.length >= (e.maxChoices || 1), B = () => m ? /* @__PURE__ */ x(v, { children: [
370
- /* @__PURE__ */ t(
371
- i,
372
- {
373
- sx: {
374
- borderRadius: c,
375
- overflow: "hidden",
376
- flexGrow: 1
377
- },
378
- children: /* @__PURE__ */ t(Ne, { ratio: "16/9", sx: { borderRadius: c }, children: /* @__PURE__ */ t(i, { ref: f }) })
379
- }
380
- ),
381
- /* @__PURE__ */ t(
382
- L,
383
- {
384
- level: "body-md",
385
- sx: {
386
- fontFamily: o,
387
- fontWeight: 500,
388
- fontSize: "0.935em",
389
- lineHeight: "24px",
390
- letterSpacing: "0.46px",
391
- textAlign: "center",
392
- color: h,
393
- px: r["2xs"]
394
- },
395
- children: e.option.title
396
- }
397
- )
398
- ] }) : A ? /* @__PURE__ */ x(v, { children: [
399
- /* @__PURE__ */ t(
400
- i,
401
- {
402
- sx: {
403
- borderRadius: c,
404
- overflow: "hidden",
405
- flexGrow: 1
406
- },
407
- children: /* @__PURE__ */ t(Ne, { ratio: "16/9", sx: { borderRadius: c }, children: /* @__PURE__ */ t(
408
- "img",
409
- {
410
- src: A,
411
- alt: "Option illustration",
412
- style: {
413
- width: "100%",
414
- height: "100%",
415
- objectFit: "cover"
416
- }
417
- }
418
- ) })
419
- }
420
- ),
421
- /* @__PURE__ */ t(
422
- L,
423
- {
424
- level: "body-md",
425
- sx: {
426
- fontFamily: o,
427
- fontWeight: 500,
428
- fontSize: "0.935em",
429
- lineHeight: "24px",
430
- letterSpacing: "0.46px",
431
- textAlign: "center",
432
- color: h,
433
- px: r["2xs"]
434
- },
435
- children: e.option.title
436
- }
437
- )
438
- ] }) : /* @__PURE__ */ t(
439
- L,
440
- {
441
- level: "body-md",
442
- sx: {
443
- fontFamily: o,
444
- fontWeight: 500,
445
- fontSize: "0.935em",
446
- lineHeight: "16px",
447
- letterSpacing: "0.46px",
448
- textAlign: "center",
449
- color: h,
450
- px: r["2xs"],
451
- my: "auto"
452
- },
453
- children: e.option.title
454
- }
455
- );
456
- return /* @__PURE__ */ t(
457
- i,
458
- {
459
- sx: {
460
- borderRadius: l,
461
- flex: 1,
462
- p: r.xs,
463
- gap: r.xs,
464
- bgcolor: S ? d : "#FFFFFF",
465
- boxShadow: S ? `inset 0 0 0 ${u} ${d}` : "none",
466
- cursor: b ? "not-allowed" : "pointer",
467
- opacity: b ? 0.5 : 1,
468
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
469
- transform: "scale(1)",
470
- "&:hover": {
471
- transform: b ? "scale(1)" : "scale(1.02)"
472
- },
473
- "&:active": {
474
- transform: b ? "scale(1)" : "scale(0.98)"
475
- },
476
- display: "flex",
477
- flexDirection: "column"
478
- },
479
- onClick: b ? void 0 : P,
480
- children: B()
481
- },
482
- e.option.id
483
- );
484
- }, tt = (e) => {
485
- if (e.optionsLayout === "twoByTwo") {
486
- const n = [];
487
- for (let a = 0; a < e.options.length; a += 2) {
488
- const l = e.options.slice(a, a + 2);
489
- n.push(l);
490
- }
491
- return /* @__PURE__ */ t(i, { sx: { py: 2, display: "flex", flexDirection: "column", gap: 2 }, children: n.map((a, l) => /* @__PURE__ */ t(
492
- i,
493
- {
494
- sx: {
495
- display: "flex",
496
- flexDirection: {
497
- xs: "column",
498
- md: "row"
499
- },
500
- gap: 2
501
- },
502
- children: a.map((o) => /* @__PURE__ */ t(
503
- Je,
504
- {
505
- option: o,
506
- optionsImages: e.optionsImages,
507
- selectedOptions: e.selectedOptions,
508
- answerPoll: e.answerPoll,
509
- brandingColors: e.brandingColors,
510
- multipleChoice: e.multipleChoice,
511
- maxChoices: e.maxChoices,
512
- isVoting: e.isVoting,
513
- disabled: e.disabled
514
- },
515
- o.id
516
- ))
517
- },
518
- `row-${l}`
519
- )) });
520
- }
521
- return e.optionsLayout === "column" ? /* @__PURE__ */ t(i, { sx: { py: 2, display: "flex", flexDirection: "column", gap: 2 }, children: e.options.map((n) => /* @__PURE__ */ t(
522
- Je,
523
- {
524
- option: n,
525
- selectedOptions: e.selectedOptions,
526
- optionsImages: e.optionsImages,
527
- answerPoll: e.answerPoll,
528
- brandingColors: e.brandingColors,
529
- multipleChoice: e.multipleChoice,
530
- maxChoices: e.maxChoices,
531
- isVoting: e.isVoting,
532
- disabled: e.disabled
533
- },
534
- n.id
535
- )) }) : /* @__PURE__ */ t(
536
- i,
537
- {
538
- sx: {
539
- py: 2,
540
- display: "flex",
541
- flexWrap: "wrap",
542
- flexDirection: { xs: "column", md: "row" },
543
- gap: 2
544
- },
545
- children: e.options.map((n) => /* @__PURE__ */ t(
546
- Je,
547
- {
548
- option: n,
549
- selectedOptions: e.selectedOptions,
550
- optionsImages: e.optionsImages,
551
- answerPoll: e.answerPoll,
552
- brandingColors: e.brandingColors,
553
- multipleChoice: e.multipleChoice,
554
- maxChoices: e.maxChoices,
555
- isVoting: e.isVoting,
556
- disabled: e.disabled
557
- },
558
- n.id
559
- ))
560
- }
561
- );
562
- }, Oe = (e) => {
563
- const n = /* @__PURE__ */ new Map(), a = Q();
564
- return e.forEach((l) => {
565
- var r, u;
566
- const c = (a ? (r = l.images) == null ? void 0 : r.mobile : (u = l.images) == null ? void 0 : u.main) || "";
567
- n.set(l.id, c);
568
- }), n;
569
- }, nn = (e) => {
570
- var $, w, _, M, Z, ce, K, ne, xe, se, le, de, p, oe, H, ye, he, ge, me, J, q, j, Y, be, ie, Ce, ue, X, Ae;
571
- const [n, a] = Re.useState(
572
- (($ = e.leads) == null ? void 0 : $.position) === "before" && e.poll.authRequirement === "LEAD"
573
- );
574
- Re.useEffect(() => {
575
- var ae;
576
- a(
577
- ((ae = e.leads) == null ? void 0 : ae.position) === "before" && e.poll.authRequirement === "LEAD" || !1
578
- );
579
- }, [(w = e.leads) == null ? void 0 : w.position, e.poll.authRequirement]);
580
- const { optionsLayout: l } = Fe(Be), o = Te(), c = ve(), r = Oe(e.options), { t: u } = O(), f = Q(), m = Me(), d = Ye(e.poll.embedCode), s = !n && !!e.poll.embedCode, h = ((_ = e.leads) == null ? void 0 : _.position) === "after" ? u("poll.buttons.continue") : u("poll.buttons.vote"), { brandingImage: A, brandingColors: P, brandingLogo: S } = Qe(e.poll.branding || null), b = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : Q() ? Ve : ze, B = A || Ue(
581
- {
582
- images: e.poll.images,
583
- imagePlaceholder: b
584
- },
585
- G.OVERLAY
586
- ), C = c.customRadius.dark.sm, R = (P == null ? void 0 : P.backgroundColor) || ((Z = (M = c.colorSchemes) == null ? void 0 : M.dark) == null ? void 0 : Z.surfaceVariant), V = (K = (ce = c.customRadius) == null ? void 0 : ce.light) == null ? void 0 : K.xl, T = (P == null ? void 0 : P.primaryColor) || ((le = (se = (xe = (ne = c.colorSchemes) == null ? void 0 : ne.light) == null ? void 0 : xe.palette) == null ? void 0 : se.primary) == null ? void 0 : le.plainColor), y = (H = (oe = (p = (de = c.colorSchemes) == null ? void 0 : de.light) == null ? void 0 : p.palette) == null ? void 0 : oe.primary) == null ? void 0 : H.onPrimary, N = c.customFontFamily.dark.primary, g = c.colorSchemes.dark.textColor, z = tn({
587
- spacingScale: o,
588
- smBorderRadius: C,
589
- contentBgColor: R,
590
- buttonRadius: V,
591
- primaryColor: T,
592
- onPrimaryColor: y,
593
- fontFamilyPrimary: N,
594
- darkTextColor: g,
595
- isMobile: f
596
- }), k = () => {
597
- a(!1);
598
- }, te = () => {
599
- var ae, Le, Se, Ie, Pe;
600
- return /* @__PURE__ */ t(
601
- W,
602
- {
603
- brandingLogo: S,
604
- textColor: c.colorSchemes.dark.textColor,
605
- label: ((ae = e.poll.labels) == null ? void 0 : ae.sponsor) || null,
606
- primaryUrl: (Se = (Le = e.poll.branding) == null ? void 0 : Le.urls) == null ? void 0 : Se.primaryUrl,
607
- secondaryUrl: (Pe = (Ie = e.poll.branding) == null ? void 0 : Ie.urls) == null ? void 0 : Pe.secondaryUrl
608
- }
609
- );
610
- };
611
- return /* @__PURE__ */ t(
612
- At,
613
- {
614
- entity: e.poll,
615
- headline: u("poll.headline"),
616
- finalImage: B,
617
- rulesDisplay: e.rulesDisplay,
618
- children: /* @__PURE__ */ x(i, { sx: z.mainContentSection, children: [
619
- /* @__PURE__ */ t(i, { sx: z.contentContainerWithBackdrop, children: e.applyConsentGate ? /* @__PURE__ */ t(
620
- Ee,
621
- {
622
- consents: e.consents,
623
- primaryColor: T,
624
- textColor: (P == null ? void 0 : P.contentColor) || g,
625
- brandingUrls: (ye = e.poll.branding) == null ? void 0 : ye.urls
626
- }
627
- ) : n ? /* @__PURE__ */ t(
628
- We,
629
- {
630
- sdk: e.sdk,
631
- startGame: k,
632
- contentId: e.poll.id,
633
- contentName: e.poll.title,
634
- brandingColors: (he = e.poll.branding) == null ? void 0 : he.colors,
635
- brandingUrls: (ge = e.poll.branding) == null ? void 0 : ge.urls,
636
- campaignId: (me = e.leads) == null ? void 0 : me.campaignId,
637
- campaignName: (J = e.leads) == null ? void 0 : J.campaignName,
638
- fields: (q = e.leads) == null ? void 0 : q.fields,
639
- leadTitle: (j = e.poll.labels) == null ? void 0 : j.leadTitle,
640
- leadDescription: (Y = e.poll.labels) == null ? void 0 : Y.leadDescription,
641
- leadCta: (be = e.poll.labels) == null ? void 0 : be.leadCta,
642
- leadSuccessTitle: (ie = e.poll.labels) == null ? void 0 : ie.leadSuccessTitle,
643
- leadSuccessDescription: (Ce = e.poll.labels) == null ? void 0 : Ce.leadSuccessDescription,
644
- syncWithProfile: (ue = e.leads) == null ? void 0 : ue.syncWithProfile,
645
- consents: e.leadConsents
646
- }
647
- ) : /* @__PURE__ */ x(v, { children: [
648
- s && /* @__PURE__ */ t(i, { sx: { overflow: "hidden", borderRadius: C }, children: /* @__PURE__ */ t(
649
- Ne,
650
- {
651
- ratio: "16/9",
652
- slotProps: { content: { sx: { height: "100%" } } },
653
- children: /* @__PURE__ */ t(i, { ref: d })
654
- }
655
- ) }),
656
- e.poll.alternativeTitle ? /* @__PURE__ */ t(i, { sx: z.alternativeTitleSection, children: /* @__PURE__ */ t(L, { level: "body-lg", sx: z.alternativeTitleText, children: e.poll.alternativeTitle }) }) : /* @__PURE__ */ t(v, {}),
657
- /* @__PURE__ */ t(
658
- tt,
659
- {
660
- options: e.options || [],
661
- answerPoll: e.answerPoll,
662
- selectedOptions: e.selectedOptions,
663
- optionsLayout: m ? "column" : l ?? "row",
664
- brandingColors: P,
665
- optionsImages: r,
666
- multipleChoice: e.poll.multipleChoice,
667
- maxChoices: e.optionChoices,
668
- isVoting: e.isVoting,
669
- disabled: e.signInRequired
670
- }
671
- )
672
- ] }) }),
673
- /* @__PURE__ */ x(i, { sx: z.bottomFooterContainer, children: [
674
- te(),
675
- e.applyConsentGate ? /* @__PURE__ */ t(
676
- _e,
677
- {
678
- onClick: e.startVoting,
679
- label: ((Ae = (X = e.consents) == null ? void 0 : X.labels) == null ? void 0 : Ae.ctaLabel) || u("poll.buttons.start"),
680
- isSubmitting: e.isSubmitting,
681
- primaryColor: T,
682
- showArrow: !1
683
- }
684
- ) : !n && (e.signInRequired ? /* @__PURE__ */ t(
685
- Ge,
686
- {
687
- signInCTA: e.signInCTA,
688
- primaryColor: T
689
- }
690
- ) : /* @__PURE__ */ t(
691
- He,
692
- {
693
- variant: "soft",
694
- sx: z.nextButton,
695
- onClick: e.voteForPoll,
696
- loading: e.isVoting,
697
- disabled: e.selectedOptions.length === 0 || e.isVoting,
698
- children: /* @__PURE__ */ t(L, { sx: z.nextButtonText, children: h })
699
- }
700
- ))
701
- ] })
702
- ] })
703
- }
704
- );
705
- }, Ze = (e) => {
706
- const n = fe().primary, a = re().xl, l = D().palette.primary.onPrimary, o = e.selectedOptions.length === 0 || e.isVoting;
707
- return /* @__PURE__ */ t(v, { children: /* @__PURE__ */ t(
708
- He,
709
- {
710
- variant: "soft",
711
- disabled: o,
712
- loading: e.isVoting,
713
- sx: {
714
- borderRadius: a,
715
- py: "10px",
716
- px: "16px",
717
- bgcolor: e.buttonColor,
718
- color: l,
719
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
720
- transform: "scale(1)",
721
- alignSelf: "center",
722
- "&:hover": {
723
- bgcolor: e.buttonColor,
724
- transform: "scale(1.02)"
725
- },
726
- "&:active": {
727
- color: l,
728
- transform: "scale(0.98)"
729
- },
730
- "&:disabled": {
731
- bgcolor: e.buttonColor,
732
- color: l,
733
- opacity: "12%"
734
- },
735
- "--Icon-color": l,
736
- fontSize: "0.9375em"
737
- },
738
- onClick: e.onClick,
739
- slotProps: {
740
- loadingIndicatorCenter: {
741
- sx: {
742
- "& .MuiCircularProgress-track": {
743
- stroke: "#FFFFFF"
744
- }
745
- }
746
- }
747
- },
748
- children: /* @__PURE__ */ t(
749
- L,
750
- {
751
- sx: {
752
- fontFamily: n,
753
- fontWeight: 500,
754
- fontSize: "0.9375em",
755
- lineHeight: "24px",
756
- letterSpacing: "0.46px",
757
- textTransform: "uppercase",
758
- color: l,
759
- gap: "8px",
760
- display: "flex",
761
- alignItems: "center",
762
- visibility: e.isVoting ? "hidden" : "visible"
763
- },
764
- children: e.label
765
- }
766
- )
767
- }
768
- ) });
769
- }, ee = ({
770
- children: e,
771
- brandingBorderColor: n,
772
- state: a
773
- }) => {
774
- const l = Q(), o = Me(), c = a === "play" ? o : l, r = re().md, u = n || D().secondaryContainer, m = $e().size + " solid " + u;
775
- return /* @__PURE__ */ t(
776
- i,
777
- {
778
- sx: {
779
- display: "flex",
780
- // flexDirection: mobile ? "column" : "row",
781
- flexDirection: c ? "column" : "row",
782
- width: "100%",
783
- borderRadius: r,
784
- boxShadow: "md",
785
- border: m,
786
- overflow: "hidden",
787
- background: D().surface,
788
- minHeight: "250px"
789
- },
790
- children: e
791
- }
792
- );
793
- }, ln = (e) => ({
794
- // Lead collection container
795
- leadCollectionContainer: {
796
- display: "flex",
797
- flexDirection: "column",
798
- p: e.spacingScale.md
799
- },
800
- // Lead question container
801
- leadQuestionContainer: {
802
- display: "flex",
803
- flexDirection: "column",
804
- gap: { xs: e.spacingScale.lg, md: e.spacingScale.md }
805
- },
806
- // Lead content container
807
- leadContentContainer: {
808
- borderRadius: e.mdBorderRadius,
809
- px: e.spacingScale.md,
810
- pt: e.spacingScale.md,
811
- pb: e.spacingScale.lg,
812
- gap: e.spacingScale.md,
813
- bgcolor: `rgba(${e.bgcolor ? e.bgcolor.replace(/[^\d,]/g, "") : ""}, 0.5)`,
814
- display: "flex",
815
- flexDirection: "column",
816
- backdropFilter: "blur(4px)"
817
- },
818
- // Question area
819
- questionArea: {
820
- display: "flex",
821
- flexDirection: "column",
822
- p: e.spacingScale.md
823
- },
824
- // Question container
825
- questionContainer: {
826
- display: "flex",
827
- flexDirection: "column",
828
- gap: { xs: e.spacingScale.lg, md: e.spacingScale.md }
829
- },
830
- // Question content container
831
- questionContentContainer: {
832
- borderRadius: e.mdBorderRadius,
833
- px: e.spacingScale.md,
834
- pt: e.spacingScale.md,
835
- pb: e.spacingScale.lg,
836
- gap: e.spacingScale.md,
837
- bgcolor: `rgba(${e.bgcolor ? e.bgcolor.replace(/[^\d,]/g, "") : ""}, 0.5)`,
838
- display: "flex",
839
- flexDirection: "column",
840
- backdropFilter: "blur(4px)"
841
- },
842
- // Question text container
843
- questionTextContainer: {
844
- gap: "8px",
845
- display: "flex",
846
- justifyContent: "center"
847
- },
848
- // Question text
849
- questionText: {
850
- fontFamily: e.fontFamilyPrimary,
851
- lineHeight: "150%",
852
- letterSpacing: "0.15px",
853
- fontWeight: 500,
854
- fontSize: "1.25em",
855
- textAlign: "center",
856
- color: e.textColor
857
- },
858
- // Footer container
859
- footerContainer: {
860
- display: "flex",
861
- flexDirection: e.isExtraSmall ? "column" : "row",
862
- justifyContent: "space-between",
863
- alignItems: "center",
864
- gap: e.spacingScale.lg
865
- },
866
- // Footer container (no logo)
867
- footerContainerNoLogo: {
868
- display: "flex",
869
- flexDirection: e.isExtraSmall ? "column" : "row",
870
- justifyContent: "flex-end",
871
- alignItems: "center",
872
- gap: e.spacingScale.lg
873
- },
874
- // Navigation container
875
- navigationContainer: {
876
- display: "flex",
877
- gap: e.spacingScale.md,
878
- justifyContent: "center",
879
- alignItems: "center"
880
- }
881
- }), on = (e) => {
882
- var k, te, $, w, _, M, Z, ce, K, ne, xe, se, le, de, p, oe, H, ye, he, ge, me;
883
- const [n, a] = Re.useState(
884
- ((k = e.leads) == null ? void 0 : k.position) === "before" && e.poll.authRequirement === "LEAD"
885
- );
886
- Re.useEffect(() => {
887
- var J;
888
- a(
889
- ((J = e.leads) == null ? void 0 : J.position) === "before" && e.poll.authRequirement === "LEAD" || !1
890
- );
891
- }, [(te = e.leads) == null ? void 0 : te.position, e.poll.authRequirement]);
892
- const { optionsLayout: l } = Fe(Be), o = Ye(e.poll.embedCode), c = !n && !!e.poll.embedCode, r = Oe(e.options), { t: u } = O(), f = Q(), m = vt(), d = (($ = e.poll.branding) == null ? void 0 : $.colors) || null, s = f ? ((_ = (w = e.poll.branding) == null ? void 0 : w.images) == null ? void 0 : _.mobileLogo) || ((Z = (M = e.poll.branding) == null ? void 0 : M.images) == null ? void 0 : Z.mainLogo) || "" : ((K = (ce = e.poll.branding) == null ? void 0 : ce.images) == null ? void 0 : K.mainLogo) || "", h = e.imagePosition || "left", A = Ue(
893
- {
894
- images: e.poll.images,
895
- imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
896
- },
897
- G.STANDARD
898
- ), P = ((ne = e.leads) == null ? void 0 : ne.position) === "after" ? u("poll.buttons.continue") : u("poll.buttons.vote"), S = m || f && !!A, b = (d == null ? void 0 : d.contentColor) || D().textColor, B = fe().primary, C = (d == null ? void 0 : d.backgroundColor) || D().surfaceVariant, R = re().md, V = (d == null ? void 0 : d.primaryColor) || D().palette.primary.plainColor, T = Te(), y = ln({
899
- spacingScale: T,
900
- fontFamilyPrimary: B,
901
- textColor: b,
902
- bgcolor: De(C || ""),
903
- mdBorderRadius: R,
904
- isExtraSmall: S
905
- }), N = () => {
906
- a(!1);
907
- }, g = (J) => {
908
- var q, j, Y, be, ie;
909
- return /* @__PURE__ */ t(
910
- W,
911
- {
912
- brandingLogo: s,
913
- textColor: J,
914
- label: ((q = e.poll.labels) == null ? void 0 : q.sponsor) || null,
915
- primaryUrl: (Y = (j = e.poll.branding) == null ? void 0 : j.urls) == null ? void 0 : Y.primaryUrl,
916
- secondaryUrl: (ie = (be = e.poll.branding) == null ? void 0 : be.urls) == null ? void 0 : ie.secondaryUrl
917
- }
918
- );
919
- }, z = () => {
920
- var J, q, j;
921
- return /* @__PURE__ */ t(i, { sx: y.questionArea, children: /* @__PURE__ */ x(i, { sx: y.questionContainer, children: [
922
- /* @__PURE__ */ t(i, { sx: y.questionContentContainer, children: /* @__PURE__ */ t(
923
- Ee,
924
- {
925
- consents: e.consents,
926
- primaryColor: V,
927
- textColor: b,
928
- brandingUrls: (J = e.poll.branding) == null ? void 0 : J.urls,
929
- align: "center"
930
- }
931
- ) }),
932
- /* @__PURE__ */ x(
933
- i,
934
- {
935
- sx: s ? y.footerContainer : y.footerContainerNoLogo,
936
- children: [
937
- s && !S ? g(b) : /* @__PURE__ */ t(v, {}),
938
- /* @__PURE__ */ t(i, { sx: y.navigationContainer, children: /* @__PURE__ */ t(
939
- _e,
940
- {
941
- onClick: e.startVoting,
942
- label: ((j = (q = e.consents) == null ? void 0 : q.labels) == null ? void 0 : j.ctaLabel) || u("poll.buttons.start"),
943
- isSubmitting: e.isSubmitting,
944
- primaryColor: V,
945
- showArrow: !1
946
- }
947
- ) })
948
- ]
949
- }
950
- ),
951
- s && S ? g(b) : /* @__PURE__ */ t(v, {})
952
- ] }) });
953
- };
954
- return /* @__PURE__ */ t(ee, { brandingBorderColor: (d == null ? void 0 : d.borderColor) || null, children: /* @__PURE__ */ t(
955
- Lt,
956
- {
957
- entity: e.poll,
958
- headline: u("poll.headline"),
959
- finalImage: A,
960
- imagePosition: h,
961
- rulesDisplay: e.rulesDisplay,
962
- embedCodeContainerRef: o,
963
- hasEmbedCode: c,
964
- children: /* @__PURE__ */ t(v, { children: e.applyConsentGate ? z() : n ? /* @__PURE__ */ t(i, { sx: y.leadCollectionContainer, children: /* @__PURE__ */ x(i, { sx: y.leadQuestionContainer, children: [
965
- /* @__PURE__ */ t(i, { sx: y.leadContentContainer, children: /* @__PURE__ */ t(
966
- We,
967
- {
968
- sdk: e.sdk,
969
- startGame: N,
970
- contentId: e.poll.id,
971
- contentName: e.poll.title,
972
- brandingColors: (xe = e.poll.branding) == null ? void 0 : xe.colors,
973
- brandingUrls: (se = e.poll.branding) == null ? void 0 : se.urls,
974
- campaignId: (le = e.leads) == null ? void 0 : le.campaignId,
975
- campaignName: (de = e.leads) == null ? void 0 : de.campaignName,
976
- fields: (p = e.leads) == null ? void 0 : p.fields,
977
- leadTitle: (oe = e.poll.labels) == null ? void 0 : oe.leadTitle,
978
- leadDescription: (H = e.poll.labels) == null ? void 0 : H.leadDescription,
979
- leadCta: (ye = e.poll.labels) == null ? void 0 : ye.leadCta,
980
- leadSuccessTitle: (he = e.poll.labels) == null ? void 0 : he.leadSuccessTitle,
981
- leadSuccessDescription: (ge = e.poll.labels) == null ? void 0 : ge.leadSuccessDescription,
982
- syncWithProfile: (me = e.leads) == null ? void 0 : me.syncWithProfile,
983
- consents: e.leadConsents
984
- }
985
- ) }),
986
- g(b)
987
- ] }) }) : /* @__PURE__ */ t(v, { children: /* @__PURE__ */ t(i, { sx: y.questionArea, children: /* @__PURE__ */ x(i, { sx: y.questionContainer, children: [
988
- /* @__PURE__ */ x(i, { sx: y.questionContentContainer, children: [
989
- e.poll.alternativeTitle ? /* @__PURE__ */ t(i, { sx: y.questionTextContainer, children: /* @__PURE__ */ t(L, { level: "body-lg", sx: y.questionText, children: e.poll.alternativeTitle }) }) : /* @__PURE__ */ t(v, {}),
990
- /* @__PURE__ */ t(
991
- tt,
992
- {
993
- options: e.options || [],
994
- answerPoll: e.answerPoll,
995
- selectedOptions: e.selectedOptions,
996
- optionsLayout: l ?? "twoByTwo",
997
- optionsImages: r,
998
- brandingColors: d,
999
- multipleChoice: e.poll.multipleChoice,
1000
- maxChoices: e.optionChoices,
1001
- isVoting: e.isVoting,
1002
- disabled: e.signInRequired
1003
- }
1004
- )
1005
- ] }),
1006
- /* @__PURE__ */ x(
1007
- i,
1008
- {
1009
- sx: s ? y.footerContainer : y.footerContainerNoLogo,
1010
- children: [
1011
- s && !S ? g(b) : /* @__PURE__ */ t(v, {}),
1012
- /* @__PURE__ */ t(i, { sx: y.navigationContainer, children: e.signInRequired ? /* @__PURE__ */ t(
1013
- Ge,
1014
- {
1015
- signInCTA: e.signInCTA,
1016
- primaryColor: V
1017
- }
1018
- ) : /* @__PURE__ */ t(
1019
- Ze,
1020
- {
1021
- selectedOptions: e.selectedOptions,
1022
- label: P,
1023
- buttonColor: V,
1024
- onClick: e.voteForPoll,
1025
- isVoting: e.isVoting
1026
- }
1027
- ) })
1028
- ]
1029
- }
1030
- ),
1031
- s && S ? g(b) : /* @__PURE__ */ t(v, {})
1032
- ] }) }) }) })
1033
- }
1034
- ) });
1035
- }, an = (e) => {
1036
- var n, a, l, o, c, r;
1037
- return {
1038
- // Main headline section with background image
1039
- headlineSection: {
1040
- display: "flex",
1041
- flexDirection: "column",
1042
- justifyContent: "space-between",
1043
- gap: "10px",
1044
- flex: e.isLarge ? "1" : "0 0 50%",
1045
- width: e.isLarge ? "100%" : "50%",
1046
- minWidth: e.isLarge ? "100%" : "50%",
1047
- maxWidth: e.isLarge ? "100%" : "50%",
1048
- backgroundImage: `url("${e.finalImage}")`,
1049
- backgroundSize: "cover",
1050
- backgroundPosition: "center",
1051
- borderTopLeftRadius: e.borderRadius.md,
1052
- borderTopRightRadius: e.isLarge ? e.borderRadius.md : 0,
1053
- borderBottomLeftRadius: e.isLarge ? 0 : e.borderRadius.md,
1054
- overflow: "hidden",
1055
- height: "auto",
1056
- position: "relative",
1057
- minHeight: e.isLarge ? "210px" : "430px",
1058
- "&::before": {
1059
- content: '""',
1060
- position: "absolute",
1061
- width: "100%",
1062
- height: "100%",
1063
- background: e.imageBackgroundGradient,
1064
- borderTopLeftRadius: "5px",
1065
- borderTopRightRadius: "5px"
1066
- }
1067
- },
1068
- embedCodeHeadlineSection: {
1069
- flex: e.isLarge ? "1" : "0 0 50%",
1070
- width: e.isLarge ? "100%" : "50%",
1071
- minWidth: e.isLarge ? "100%" : "50%",
1072
- maxWidth: e.isLarge ? "100%" : "50%",
1073
- borderTopLeftRadius: e.borderRadius.md,
1074
- borderTopRightRadius: e.isLarge ? e.borderRadius.md : 0,
1075
- borderBottomLeftRadius: e.isLarge ? 0 : e.borderRadius.md,
1076
- overflow: "hidden",
1077
- height: "auto",
1078
- position: "relative",
1079
- minHeight: e.isLarge ? "210px" : "430px"
1080
- },
1081
- // Headline content wrapper
1082
- embedCodeHeadlineContent: {
1083
- gap: e.spacingScale.xl,
1084
- display: "flex",
1085
- flexDirection: "column",
1086
- alignItems: "center"
1087
- },
1088
- // Filter screen area
1089
- filterScreenArea: {
1090
- flex: "0.5",
1091
- display: "flex",
1092
- flexDirection: "column",
1093
- p: e.spacingScale.lg
1094
- },
1095
- // Filter screen headline section
1096
- filterScreenHeadlineContent: {
1097
- display: "flex",
1098
- flexDirection: "column",
1099
- justifyContent: "space-between",
1100
- gap: e.spacingScale["2xl"],
1101
- textAlign: "center"
1102
- },
1103
- // Filter screen headline text
1104
- filterScreenHeadlineText: {
1105
- fontWeight: 500,
1106
- lineHeight: "166%",
1107
- letterSpacing: "1px",
1108
- textTransform: "uppercase",
1109
- fontSize: "0.75em",
1110
- color: e.secondaryColor,
1111
- opacity: e.opacity,
1112
- fontFamily: e.fontFamilySecondary
1113
- },
1114
- // Filter screen title text
1115
- filterScreenTitleText: {
1116
- fontWeight: 700,
1117
- lineHeight: "133%",
1118
- letterSpacing: "0px",
1119
- fontSize: "1.5em",
1120
- color: e.textColor,
1121
- fontFamily: e.fontFamilyPrimary
1122
- },
1123
- // Filter screen description text
1124
- filterScreenDescriptionText: {
1125
- fontWeight: 400,
1126
- lineHeight: "140%",
1127
- letterSpacing: "0.15px",
1128
- fontSize: "1.25em",
1129
- color: e.secondaryColor,
1130
- opacity: e.opacity,
1131
- fontFamily: e.fontFamilyPrimary
1132
- },
1133
- // Filter screen CTA wrapper
1134
- filterScreenCtaWrapper: {
1135
- display: "flex",
1136
- flexDirection: "column",
1137
- justifyContent: "space-between",
1138
- alignItems: "center",
1139
- gap: e.spacingScale["2xl"]
1140
- },
1141
- // Headline content wrapper
1142
- headlineContent: {
1143
- zIndex: 1,
1144
- height: "100%",
1145
- p: e.spacingScale.xl,
1146
- gap: e.spacingScale.xl,
1147
- display: "flex",
1148
- flexDirection: "column",
1149
- justifyContent: "space-between"
1150
- },
1151
- // Poll headline typography
1152
- pollHeadlineText: {
1153
- fontWeight: 500,
1154
- lineHeight: "166%",
1155
- letterSpacing: "1px",
1156
- fontSize: "0.75em",
1157
- color: ((n = e.brandingColors) == null ? void 0 : n.secondaryColor) || e.darkTextColor,
1158
- opacity: "70%",
1159
- textTransform: "uppercase",
1160
- fontFamily: e.fontFamilySecondary,
1161
- textAlign: e.isLarge ? "center" : "left"
1162
- },
1163
- // Poll headline typography on filter screen
1164
- pollHeadlineTextFilterScreen: {
1165
- fontWeight: 500,
1166
- lineHeight: "166%",
1167
- letterSpacing: "1px",
1168
- fontSize: "0.75em",
1169
- color: ((a = e.brandingColors) == null ? void 0 : a.secondaryColor) || e.textColor,
1170
- opacity: "70%",
1171
- textTransform: "uppercase",
1172
- fontFamily: e.fontFamilySecondary,
1173
- textAlign: e.isLarge ? "center" : "left"
1174
- },
1175
- // Content container
1176
- contentContainer: {
1177
- display: "flex",
1178
- flexDirection: "column",
1179
- gap: e.spacingScale["3xs"]
1180
- },
1181
- // Poll title typography
1182
- pollTitleText: {
1183
- fontWeight: 700,
1184
- lineHeight: "133%",
1185
- fontSize: "1.5em",
1186
- letterSpacing: "0.15px",
1187
- color: ((l = e.brandingColors) == null ? void 0 : l.contentColor) || e.darkTextColor,
1188
- fontFamily: e.fontFamilyPrimary,
1189
- textAlign: e.isLarge ? "center" : "left"
1190
- },
1191
- // Poll title typography on filter screen
1192
- pollTitleTextFilterScreen: {
1193
- fontWeight: 700,
1194
- lineHeight: "133%",
1195
- fontSize: "1.5em",
1196
- letterSpacing: "0.15px",
1197
- color: ((o = e.brandingColors) == null ? void 0 : o.contentColor) || e.textColor,
1198
- fontFamily: e.fontFamilyPrimary,
1199
- textAlign: e.isLarge ? "center" : "left"
1200
- },
1201
- // Poll description typography
1202
- pollDescriptionText: {
1203
- fontWeight: 400,
1204
- lineHeight: "140%",
1205
- fontSize: "1.25em",
1206
- letterSpacing: "0.15px",
1207
- color: ((c = e.brandingColors) == null ? void 0 : c.secondaryColor) || e.darkTextColor,
1208
- opacity: "70%",
1209
- fontFamily: e.fontFamilyPrimary,
1210
- textAlign: e.isLarge ? "center" : "left"
1211
- },
1212
- // Poll description typography on filter screen
1213
- pollDescriptionTextFilterScreen: {
1214
- fontWeight: 400,
1215
- lineHeight: "140%",
1216
- fontSize: "1.25em",
1217
- letterSpacing: "0.15px",
1218
- color: ((r = e.brandingColors) == null ? void 0 : r.secondaryColor) || e.textColor,
1219
- opacity: "70%",
1220
- fontFamily: e.fontFamilyPrimary,
1221
- textAlign: e.isLarge ? "center" : "left"
1222
- },
1223
- // Filter screen bottom container
1224
- filterScreenBottomContainer: {
1225
- display: "flex",
1226
- flexDirection: e.isLarge ? "column-reverse" : "row",
1227
- justifyContent: "space-between",
1228
- alignItems: "center",
1229
- gap: e.spacingScale.lg
1230
- },
1231
- // Start button (filter screen)
1232
- startButton: {
1233
- borderRadius: e.buttonRadius,
1234
- bgcolor: e.primaryColor,
1235
- color: e.onPrimaryColor,
1236
- "&:hover": {
1237
- bgcolor: e.primaryColor
1238
- },
1239
- "&:active": {
1240
- color: e.onPrimaryColor
1241
- },
1242
- animation: "pulse 1s infinite",
1243
- fontSize: "0.9375em",
1244
- py: "10px",
1245
- pr: "12px",
1246
- pl: "16px",
1247
- "--Icon-color": e.onPrimaryColor
1248
- },
1249
- // Start button text
1250
- startButtonText: {
1251
- fontFamily: e.fontFamilyPrimary,
1252
- fontWeight: 500,
1253
- fontSize: "0.9375em",
1254
- lineHeight: "24px",
1255
- letterSpacing: "0.46px",
1256
- textTransform: "uppercase",
1257
- color: e.onPrimaryColor,
1258
- gap: "8px",
1259
- display: "flex",
1260
- alignItems: "center"
1261
- },
1262
- // Presented by desktop container
1263
- presentedByDesktop: {
1264
- display: e.isLarge ? "none" : "block"
1265
- },
1266
- // Question area
1267
- questionArea: {
1268
- width: "100%",
1269
- display: "flex",
1270
- flexDirection: "column",
1271
- justifyContent: "center"
1272
- },
1273
- // Stopwatch container
1274
- stopwatchContainer: {
1275
- display: "flex",
1276
- justifyContent: "center"
1277
- },
1278
- // Lead content container (filter screen)
1279
- leadContentContainer: {
1280
- p: e.spacingScale.md,
1281
- gap: e.spacingScale.md,
1282
- display: "flex",
1283
- flexDirection: "column",
1284
- backdropFilter: "blur(4px)",
1285
- bgcolor: `rgba(${e.bgcolor ? e.bgcolor.replace(/[^\d,]/g, "") : ""}, 0.5)`,
1286
- borderRadius: e.borderRadius.sm
1287
- },
1288
- // Question area content wrapper
1289
- questionAreaContent: {
1290
- p: e.spacingScale.lg,
1291
- display: "flex",
1292
- flexDirection: "column",
1293
- justifyContent: "center",
1294
- gap: "16px"
1295
- },
1296
- // Main content container
1297
- mainContentContainer: {
1298
- p: e.spacingScale.lg,
1299
- gap: e.spacingScale.md,
1300
- display: "flex",
1301
- flexDirection: "column",
1302
- backdropFilter: "blur(4px)",
1303
- bgcolor: `rgba(${e.bgcolor ? e.bgcolor.replace(/[^\d,]/g, "") : ""}, 0.5)`,
1304
- borderRadius: e.borderRadius.sm
1305
- },
1306
- // Aspect ratio container for embed/image
1307
- aspectRatioContainer: {
1308
- borderRadius: e.borderRadius.sm,
1309
- height: "100%",
1310
- flex: 1,
1311
- // Take all available space
1312
- "& > div": {
1313
- height: "100% !important",
1314
- flex: "1 !important"
1315
- // Force flex growth
1316
- }
1317
- },
1318
- // Question image container
1319
- questionImageContainer: {
1320
- overflow: "hidden",
1321
- borderRadius: e.borderRadius.sm
1322
- },
1323
- // Question image box
1324
- questionImageBox: {
1325
- borderRadius: e.borderRadius.sm,
1326
- overflow: "hidden",
1327
- height: "auto"
1328
- },
1329
- // Question image
1330
- questionImage: {
1331
- width: "100%",
1332
- height: "100%",
1333
- objectFit: "cover"
1334
- },
1335
- // Alternative title section
1336
- alternativeTitleSection: {
1337
- gap: "8px",
1338
- display: "flex",
1339
- justifyContent: "center"
1340
- },
1341
- // Alternative title text
1342
- alternativeTitleText: {
1343
- fontFamily: e.fontFamilyPrimary,
1344
- lineHeight: "150%",
1345
- letterSpacing: "0.15px",
1346
- fontWeight: 500,
1347
- fontSize: "1.25em",
1348
- textAlign: "center",
1349
- color: e.textColor
1350
- },
1351
- // Button and footer container
1352
- buttonFooterContainer: {
1353
- display: "flex",
1354
- flexDirection: "column",
1355
- gap: e.spacingScale.lg
1356
- },
1357
- // Presented by mobile container
1358
- presentedByMobile: {
1359
- display: e.isLarge ? "flex" : "none",
1360
- justifyContent: "center"
1361
- }
1362
- };
1363
- }, rn = (e) => {
1364
- var ce, K, ne, xe, se, le, de, p, oe, H, ye, he, ge, me, J, q, j, Y, be, ie, Ce, ue;
1365
- const [n, a] = Re.useState(
1366
- ((ce = e.leads) == null ? void 0 : ce.position) === "before" && e.poll.authRequirement === "LEAD"
1367
- );
1368
- Re.useEffect(() => {
1369
- var X;
1370
- a(
1371
- ((X = e.leads) == null ? void 0 : X.position) === "before" && e.poll.authRequirement === "LEAD" || !1
1372
- );
1373
- }, [(K = e.leads) == null ? void 0 : K.position, e.poll.authRequirement]);
1374
- const { optionsLayout: l } = Fe(Be), o = ve(), c = Q(), r = Me(), u = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : c ? Ve : ze, f = Ue(
1375
- {
1376
- images: e.poll.images,
1377
- imagePlaceholder: u
1378
- },
1379
- G.SPLIT
1380
- ), m = Oe(e.options), { t: d } = O(), s = ((ne = e.poll.branding) == null ? void 0 : ne.colors) || null, h = c ? ((xe = e.poll.branding) == null ? void 0 : xe.images.mobileLogo) || ((se = e.poll.branding) == null ? void 0 : se.images.mainLogo) || "" : ((le = e.poll.branding) == null ? void 0 : le.images.mainLogo) || "", A = Ye(e.poll.embedCode), P = !n && !!e.poll.embedCode, S = ((de = e.leads) == null ? void 0 : de.position) === "after" ? d("poll.buttons.continue") : d("poll.buttons.vote"), b = (s == null ? void 0 : s.contentColor) || D().textColor, B = fe().secondary, C = "60%", R = fe().primary, V = re().xl, T = (s == null ? void 0 : s.backgroundColor) || D().surfaceVariant, y = (s == null ? void 0 : s.primaryColor) || ((oe = (p = D().palette) == null ? void 0 : p.primary) == null ? void 0 : oe.plainColor), N = (ye = (H = D().palette) == null ? void 0 : H.primary) == null ? void 0 : ye.onPrimary, g = D().textColor, z = Te(), k = re(), te = mt(
1381
- G.SPLIT
1382
- ), $ = De(T || ""), w = an({
1383
- finalImage: f,
1384
- spacingScale: z,
1385
- borderRadius: k,
1386
- fontFamilyPrimary: R,
1387
- fontFamilySecondary: B,
1388
- secondaryColor: b,
1389
- opacity: C,
1390
- buttonRadius: V,
1391
- bgcolor: $,
1392
- primaryColor: y,
1393
- onPrimaryColor: N,
1394
- textColor: g,
1395
- brandingColors: s,
1396
- darkTextColor: o.colorSchemes.dark.textColor,
1397
- imageBackgroundGradient: te,
1398
- isLarge: r
1399
- }), _ = () => {
1400
- a(!1);
1401
- }, M = (X, Ae) => {
1402
- var ae, Le, Se, Ie, Pe;
1403
- return /* @__PURE__ */ t(
1404
- W,
1405
- {
1406
- brandingLogo: h,
1407
- textColor: X,
1408
- label: ((ae = e.poll.labels) == null ? void 0 : ae.sponsor) || null,
1409
- primaryUrl: (Se = (Le = e.poll.branding) == null ? void 0 : Le.urls) == null ? void 0 : Se.primaryUrl,
1410
- secondaryUrl: (Pe = (Ie = e.poll.branding) == null ? void 0 : Ie.urls) == null ? void 0 : Pe.secondaryUrl,
1411
- isCentered: Ae || !1
1412
- }
1413
- );
1414
- }, Z = () => {
1415
- var X;
1416
- return /* @__PURE__ */ t(i, { sx: w.mainContentContainer, children: /* @__PURE__ */ t(
1417
- Ee,
1418
- {
1419
- consents: e.consents,
1420
- primaryColor: y,
1421
- textColor: g,
1422
- brandingUrls: (X = e.poll.branding) == null ? void 0 : X.urls,
1423
- onSubmit: e.startVoting,
1424
- isSubmitting: e.isSubmitting,
1425
- ctaLabel: d("poll.buttons.start"),
1426
- showArrow: !1,
1427
- align: "center"
1428
- }
1429
- ) });
1430
- };
1431
- return /* @__PURE__ */ x(
1432
- ee,
1433
- {
1434
- brandingBorderColor: (s == null ? void 0 : s.borderColor) || null,
1435
- state: "play",
1436
- children: [
1437
- /* @__PURE__ */ t(
1438
- kt,
1439
- {
1440
- entity: { ...e.poll, type: "poll" },
1441
- headline: d("poll.headline"),
1442
- finalImage: f,
1443
- rulesDisplay: e.rulesDisplay,
1444
- embedCodeContainerRef: A,
1445
- hasEmbedCode: P,
1446
- brandingLogo: h,
1447
- renderPresentedBy: M,
1448
- children: /* @__PURE__ */ t(i, { sx: w.questionArea, children: /* @__PURE__ */ x(i, { sx: w.questionAreaContent, children: [
1449
- P && /* @__PURE__ */ t(i, { sx: w.embedCodeHeadlineContent, children: /* @__PURE__ */ x(i, { children: [
1450
- /* @__PURE__ */ t(
1451
- L,
1452
- {
1453
- sx: {
1454
- ...w.pollHeadlineText,
1455
- color: g,
1456
- textAlign: "center"
1457
- },
1458
- children: d("poll.headline")
1459
- }
1460
- ),
1461
- /* @__PURE__ */ x(i, { sx: w.contentContainer, children: [
1462
- /* @__PURE__ */ t(
1463
- L,
1464
- {
1465
- sx: {
1466
- ...w.pollTitleText,
1467
- color: g,
1468
- textAlign: "center"
1469
- },
1470
- children: e.poll.title
1471
- }
1472
- ),
1473
- /* @__PURE__ */ t(
1474
- L,
1475
- {
1476
- sx: {
1477
- ...w.pollDescriptionText,
1478
- color: g,
1479
- textAlign: "center"
1480
- },
1481
- children: wt(e.poll.description)
1482
- }
1483
- )
1484
- ] })
1485
- ] }) }),
1486
- e.applyConsentGate ? Z() : n ? /* @__PURE__ */ x(v, { children: [
1487
- /* @__PURE__ */ t(i, { sx: w.leadContentContainer, children: /* @__PURE__ */ t(
1488
- We,
1489
- {
1490
- sdk: e.sdk,
1491
- startGame: _,
1492
- contentId: e.poll.id,
1493
- contentName: e.poll.title,
1494
- brandingColors: (he = e.poll.branding) == null ? void 0 : he.colors,
1495
- brandingUrls: (ge = e.poll.branding) == null ? void 0 : ge.urls,
1496
- campaignId: (me = e.leads) == null ? void 0 : me.campaignId,
1497
- campaignName: (J = e.leads) == null ? void 0 : J.campaignName,
1498
- fields: (q = e.leads) == null ? void 0 : q.fields,
1499
- leadTitle: (j = e.poll.labels) == null ? void 0 : j.leadTitle,
1500
- leadDescription: (Y = e.poll.labels) == null ? void 0 : Y.leadDescription,
1501
- leadCta: (be = e.poll.labels) == null ? void 0 : be.leadCta,
1502
- leadSuccessTitle: (ie = e.poll.labels) == null ? void 0 : ie.leadSuccessTitle,
1503
- leadSuccessDescription: (Ce = e.poll.labels) == null ? void 0 : Ce.leadSuccessDescription,
1504
- syncWithProfile: (ue = e.leads) == null ? void 0 : ue.syncWithProfile,
1505
- consents: e.leadConsents
1506
- }
1507
- ) }),
1508
- h ? /* @__PURE__ */ t(i, { sx: { display: r ? "block" : "none" }, children: M(g) }) : /* @__PURE__ */ t(v, {})
1509
- ] }) : /* @__PURE__ */ t(v, { children: /* @__PURE__ */ x(i, { sx: w.mainContentContainer, children: [
1510
- e.poll.alternativeTitle ? /* @__PURE__ */ t(i, { sx: w.alternativeTitleSection, children: /* @__PURE__ */ t(
1511
- L,
1512
- {
1513
- level: "body-lg",
1514
- sx: w.alternativeTitleText,
1515
- children: e.poll.alternativeTitle
1516
- }
1517
- ) }) : /* @__PURE__ */ t(v, {}),
1518
- /* @__PURE__ */ t(
1519
- tt,
1520
- {
1521
- options: e.options || [],
1522
- answerPoll: e.answerPoll,
1523
- selectedOptions: e.selectedOptions,
1524
- optionsLayout: r ? "column" : l ?? "twoByTwo",
1525
- brandingColors: s,
1526
- optionsImages: m,
1527
- multipleChoice: e.poll.multipleChoice,
1528
- maxChoices: e.optionChoices,
1529
- isVoting: e.isVoting,
1530
- disabled: e.signInRequired
1531
- }
1532
- ),
1533
- P ? /* @__PURE__ */ x(
1534
- i,
1535
- {
1536
- sx: {
1537
- display: "flex",
1538
- flexDirection: r ? "column-reverse" : "row",
1539
- gap: z.lg,
1540
- justifyContent: h ? "space-between" : "center"
1541
- },
1542
- children: [
1543
- M(
1544
- (s == null ? void 0 : s.contentColor) || g
1545
- ),
1546
- e.signInRequired ? /* @__PURE__ */ t(
1547
- Ge,
1548
- {
1549
- signInCTA: e.signInCTA,
1550
- primaryColor: y
1551
- }
1552
- ) : /* @__PURE__ */ t(
1553
- Ze,
1554
- {
1555
- selectedOptions: e.selectedOptions,
1556
- label: S,
1557
- buttonColor: y,
1558
- onClick: e.voteForPoll,
1559
- isVoting: e.isVoting
1560
- }
1561
- )
1562
- ]
1563
- }
1564
- ) : /* @__PURE__ */ t(v, { children: /* @__PURE__ */ x(i, { sx: w.buttonFooterContainer, children: [
1565
- e.signInRequired ? /* @__PURE__ */ t(
1566
- Ge,
1567
- {
1568
- signInCTA: e.signInCTA,
1569
- primaryColor: y
1570
- }
1571
- ) : /* @__PURE__ */ t(
1572
- Ze,
1573
- {
1574
- selectedOptions: e.selectedOptions,
1575
- label: S,
1576
- buttonColor: y,
1577
- onClick: e.voteForPoll,
1578
- isVoting: e.isVoting
1579
- }
1580
- ),
1581
- h && !r ? /* @__PURE__ */ t(i, { sx: w.presentedByMobile, children: M(
1582
- (s == null ? void 0 : s.contentColor) || g
1583
- ) }) : /* @__PURE__ */ t(v, {})
1584
- ] }) })
1585
- ] }) })
1586
- ] }) })
1587
- }
1588
- ),
1589
- h && r && /* @__PURE__ */ t(i, { sx: { mb: z.lg, px: z.lg }, children: M(
1590
- (s == null ? void 0 : s.contentColor) || o.colorSchemes.dark.textColor,
1591
- !0
1592
- ) })
1593
- ]
1594
- }
1595
- );
1596
- }, cn = (e) => {
1597
- const n = re(), a = Q(), l = $e().size, o = D(), c = fe(), r = o.palette.primary.plainColor, u = o.textPrimary, f = o.textSecondary, m = o.secondaryContainer, d = o.surface, s = o.onSurface, h = `rgba(${De(o.surfaceVariant)}, 0.5)`;
1598
- return {
1599
- // Question area
1600
- questionArea: {
1601
- display: "flex",
1602
- flexDirection: "column",
1603
- px: e.spacingScale.md
1604
- },
1605
- // Question container
1606
- questionContainer: {
1607
- display: "flex",
1608
- flexDirection: "column",
1609
- gap: a ? e.spacingScale.lg : e.spacingScale.md
1610
- },
1611
- // Question content container
1612
- questionContentContainer: {
1613
- borderRadius: n.md,
1614
- px: e.spacingScale.md,
1615
- pt: e.spacingScale.md,
1616
- pb: e.spacingScale.lg,
1617
- gap: e.spacingScale.md,
1618
- bgcolor: h,
1619
- display: "flex",
1620
- flexDirection: "column",
1621
- backdropFilter: "blur(4px)"
1622
- },
1623
- // Vote again button
1624
- voteAgainButton: {
1625
- display: "flex",
1626
- py: e.spacingScale.xs,
1627
- px: "16px",
1628
- flexDirection: "column",
1629
- justifyContent: "center",
1630
- alignItems: "center",
1631
- gap: "8px",
1632
- borderRadius: n.xl,
1633
- border: l + " solid " + r,
1634
- bgcolor: d,
1635
- "&:hover": {
1636
- bgcolor: s,
1637
- borderColor: r
1638
- },
1639
- fontSize: "0.8125em"
1640
- },
1641
- // Play again button content
1642
- playAgainButtonContent: {
1643
- display: "flex",
1644
- justifyContent: "center",
1645
- alignItems: "center",
1646
- gap: "8px",
1647
- alignSelf: "stretch"
1648
- },
1649
- // Play again icon
1650
- playAgainIcon: {
1651
- display: "flex",
1652
- width: "16px",
1653
- height: "16px",
1654
- justifyContent: "flex-end",
1655
- alignItems: "center",
1656
- color: u
1657
- },
1658
- // Play again text
1659
- playAgainText: {
1660
- color: u,
1661
- textAlign: "center",
1662
- fontFamily: c.primary,
1663
- fontSize: "0.8125em",
1664
- fontStyle: "normal",
1665
- fontWeight: 500,
1666
- lineHeight: "22px",
1667
- letterSpacing: "0.46px",
1668
- textTransform: "uppercase"
1669
- },
1670
- // Additional CTA button (secondary style)
1671
- additionalCTAButton: {
1672
- display: "flex",
1673
- py: e.spacingScale.xs,
1674
- px: e.spacingScale.md,
1675
- flexDirection: "column",
1676
- justifyContent: "center",
1677
- alignItems: "center",
1678
- gap: "8px",
1679
- borderRadius: n.xl,
1680
- border: l + " solid " + m,
1681
- bgcolor: m,
1682
- "&:hover": {
1683
- bgcolor: m,
1684
- opacity: 0.9
1685
- },
1686
- fontSize: "0.8125em"
1687
- },
1688
- // Additional CTA button content
1689
- additionalCTAButtonContent: {
1690
- display: "flex",
1691
- justifyContent: "center",
1692
- alignItems: "center",
1693
- gap: "8px"
1694
- },
1695
- // Additional CTA text
1696
- additionalCTAText: {
1697
- color: f,
1698
- fontFamily: c.primary,
1699
- fontSize: "0.8125em",
1700
- fontStyle: "normal",
1701
- fontWeight: 500,
1702
- lineHeight: "22px",
1703
- letterSpacing: "0.46px",
1704
- textTransform: "uppercase"
1705
- },
1706
- // Footer container
1707
- footerContainer: {
1708
- display: "flex",
1709
- flexDirection: a ? "column" : "row",
1710
- justifyContent: "space-between",
1711
- alignItems: "center",
1712
- gap: e.spacingScale.lg
1713
- },
1714
- // Footer container (no logo)
1715
- footerContainerNoLogo: {
1716
- display: "flex",
1717
- flexDirection: a ? "column" : "row",
1718
- justifyContent: "flex-end",
1719
- alignItems: "center",
1720
- gap: e.spacingScale.lg
1721
- },
1722
- // Presented by desktop
1723
- presentedByDesktop: {
1724
- display: a ? "none" : "block"
1725
- },
1726
- // Presented by mobile
1727
- presentedByMobile: {
1728
- display: a ? "block" : "none"
1729
- },
1730
- // Alternative title section
1731
- alternativeTitleSection: {
1732
- gap: "8px",
1733
- display: "flex",
1734
- justifyContent: "center"
1735
- },
1736
- // Alternative title text
1737
- alternativeTitleText: {
1738
- fontFamily: c.primary,
1739
- lineHeight: "150%",
1740
- letterSpacing: "0.15px",
1741
- fontWeight: 500,
1742
- fontSize: "1.25em",
1743
- textAlign: "center",
1744
- color: e.textColor
1745
- }
1746
- };
1747
- }, sn = (e, n) => {
1748
- switch (e) {
1749
- case "success":
1750
- return /* @__PURE__ */ t(Qt, {});
1751
- case "error":
1752
- return /* @__PURE__ */ t(Kt, { sx: { color: n } });
1753
- case "info":
1754
- return /* @__PURE__ */ t(_t, {});
1755
- }
1756
- }, dn = (e) => {
1757
- switch (e) {
1758
- case "success":
1759
- return "success";
1760
- case "error":
1761
- return "danger";
1762
- case "info":
1763
- return "primary";
1764
- }
1765
- }, nt = ({
1766
- variant: e,
1767
- title: n,
1768
- message: a,
1769
- description: l
1770
- }) => {
1771
- const o = ve(), c = re(), r = fe().secondary, u = dn(e);
1772
- return /* @__PURE__ */ t(
1773
- $t,
1774
- {
1775
- variant: "soft",
1776
- color: u,
1777
- startDecorator: sn(
1778
- e,
1779
- o.colorSchemes.light.palette.danger.plainColor
1780
- ),
1781
- sx: {
1782
- gap: 1,
1783
- borderRadius: c.sm,
1784
- fontSize: "0.875em",
1785
- "--Icon-fontSize": "1.25em"
1786
- },
1787
- children: /* @__PURE__ */ x(
1788
- Yt,
1789
- {
1790
- sx: {
1791
- fontSize: "1.5em"
1792
- },
1793
- children: [
1794
- n && /* @__PURE__ */ t(
1795
- L,
1796
- {
1797
- level: "title-md",
1798
- color: u,
1799
- fontWeight: "bold",
1800
- sx: { fontFamily: r, fontSize: "0.875em" },
1801
- children: n
1802
- }
1803
- ),
1804
- /* @__PURE__ */ t(
1805
- L,
1806
- {
1807
- level: "body-sm",
1808
- sx: { fontFamily: r, fontSize: "0.675em" },
1809
- children: a
1810
- }
1811
- ),
1812
- l && /* @__PURE__ */ t(
1813
- L,
1814
- {
1815
- level: "body-xs",
1816
- sx: { fontFamily: r, fontSize: "0.6em" },
1817
- children: l
1818
- }
1819
- )
1820
- ]
1821
- }
1822
- )
1823
- }
1824
- );
1825
- }, Xe = (e) => {
1826
- var C;
1827
- const n = ut(), [a, l] = U(0), o = ve(), c = D(), r = re().sm, u = fe(), f = re().xs, m = Te(), d = e.optionsImages.get(e.option.id), s = e.selectedOptions.includes(e.option.id), h = ((C = e.brandingColors) == null ? void 0 : C.primaryColor) || c.palette.primary.plainColor, A = c.palette.primary.onPrimary, P = s ? A : o.colorSchemes.light.textColor, S = e.option.votes, b = e.totalVotes > 0 ? S / e.totalVotes * 100 : 0;
1828
- ke(() => {
1829
- const R = setTimeout(() => {
1830
- l(b);
1831
- }, 100);
1832
- return () => clearTimeout(R);
1833
- }, [b]);
1834
- const B = () => d ? /* @__PURE__ */ x(v, { children: [
1835
- /* @__PURE__ */ t(
1836
- i,
1837
- {
1838
- sx: {
1839
- borderRadius: f,
1840
- overflow: "hidden",
1841
- flexGrow: 1,
1842
- mb: m["2xs"]
1843
- },
1844
- children: /* @__PURE__ */ t(Ne, { ratio: "16/9", sx: { borderRadius: f }, children: /* @__PURE__ */ t(
1845
- "img",
1846
- {
1847
- src: d,
1848
- alt: "Option illustration",
1849
- style: {
1850
- width: "100%",
1851
- height: "100%",
1852
- objectFit: "cover"
1853
- }
1854
- }
1855
- ) })
1856
- }
1857
- ),
1858
- /* @__PURE__ */ x(
1859
- i,
1860
- {
1861
- sx: {
1862
- display: "flex",
1863
- alignItems: "center",
1864
- justifyContent: "center",
1865
- gap: m["2xs"],
1866
- my: m["2xs"]
1867
- },
1868
- children: [
1869
- /* @__PURE__ */ t(
1870
- je,
1871
- {
1872
- sx: {
1873
- fontSize: 12,
1874
- color: s ? A : o.colorSchemes.light.textColor
1875
- }
1876
- }
1877
- ),
1878
- /* @__PURE__ */ x(
1879
- L,
1880
- {
1881
- level: "body-sm",
1882
- sx: {
1883
- fontSize: "0.7em",
1884
- fontWeight: 500,
1885
- color: s ? A : o.colorSchemes.light.textColor,
1886
- fontFamily: u.secondary,
1887
- whiteSpace: "nowrap",
1888
- lineHeight: 1
1889
- },
1890
- children: [
1891
- S.toLocaleString(n),
1892
- " (",
1893
- b.toFixed(1),
1894
- "%)"
1895
- ]
1896
- }
1897
- )
1898
- ]
1899
- }
1900
- ),
1901
- /* @__PURE__ */ t(
1902
- L,
1903
- {
1904
- level: "body-md",
1905
- sx: {
1906
- fontFamily: u.primary,
1907
- fontWeight: 500,
1908
- fontSize: "0.935em",
1909
- lineHeight: "24px",
1910
- letterSpacing: "0.46px",
1911
- textAlign: "center",
1912
- color: P,
1913
- px: m["2xs"]
1914
- },
1915
- children: e.option.title
1916
- }
1917
- )
1918
- ] }) : /* @__PURE__ */ x(
1919
- i,
1920
- {
1921
- sx: {
1922
- position: "relative",
1923
- zIndex: 1,
1924
- display: "flex",
1925
- gap: m.xs
1926
- },
1927
- children: [
1928
- /* @__PURE__ */ x(
1929
- i,
1930
- {
1931
- sx: {
1932
- display: "flex",
1933
- flexDirection: "column",
1934
- justifyContent: "center",
1935
- gap: m["2xs"],
1936
- flexShrink: 0,
1937
- minWidth: "fit-content"
1938
- },
1939
- children: [
1940
- /* @__PURE__ */ x(
1941
- i,
1942
- {
1943
- sx: {
1944
- display: "flex",
1945
- alignItems: "center",
1946
- gap: m["2xs"]
1947
- },
1948
- children: [
1949
- /* @__PURE__ */ t(
1950
- je,
1951
- {
1952
- sx: {
1953
- fontSize: 12,
1954
- color: s ? A : o.colorSchemes.light.textColor
1955
- }
1956
- }
1957
- ),
1958
- /* @__PURE__ */ t(
1959
- L,
1960
- {
1961
- level: "body-sm",
1962
- sx: {
1963
- fontSize: "0.7em",
1964
- fontWeight: 500,
1965
- color: s ? A : o.colorSchemes.light.textColor,
1966
- fontFamily: u.secondary,
1967
- whiteSpace: "nowrap",
1968
- lineHeight: 0
1969
- },
1970
- children: S.toLocaleString(n)
1971
- }
1972
- )
1973
- ]
1974
- }
1975
- ),
1976
- /* @__PURE__ */ x(
1977
- L,
1978
- {
1979
- level: "body-sm",
1980
- sx: {
1981
- fontSize: "0.65em",
1982
- fontWeight: 400,
1983
- color: s ? A : o.colorSchemes.light.textColor,
1984
- fontFamily: u.secondary,
1985
- whiteSpace: "nowrap",
1986
- lineHeight: 1,
1987
- textAlign: "center"
1988
- },
1989
- children: [
1990
- "(",
1991
- b.toFixed(1),
1992
- "%)"
1993
- ]
1994
- }
1995
- )
1996
- ]
1997
- }
1998
- ),
1999
- /* @__PURE__ */ t(
2000
- i,
2001
- {
2002
- sx: {
2003
- display: "flex",
2004
- alignItems: "center",
2005
- flex: 1,
2006
- minWidth: 0,
2007
- gap: m.xs
2008
- },
2009
- children: /* @__PURE__ */ t(
2010
- L,
2011
- {
2012
- level: "body-md",
2013
- sx: {
2014
- fontFamily: u.primary,
2015
- fontWeight: 500,
2016
- fontSize: "0.935em",
2017
- lineHeight: "16px",
2018
- letterSpacing: "0.46px",
2019
- color: P,
2020
- flex: 1,
2021
- minWidth: 0,
2022
- wordBreak: "break-word",
2023
- hyphens: "auto",
2024
- textAlign: "center"
2025
- },
2026
- children: e.option.title
2027
- }
2028
- )
2029
- }
2030
- )
2031
- ]
2032
- }
2033
- );
2034
- return /* @__PURE__ */ x(
2035
- i,
2036
- {
2037
- sx: {
2038
- borderRadius: r,
2039
- flex: 1,
2040
- p: m.xs,
2041
- bgcolor: s ? h : "#FFFFFF",
2042
- display: "flex",
2043
- flexDirection: "column",
2044
- position: "relative",
2045
- overflow: "hidden",
2046
- justifyContent: "center"
2047
- },
2048
- children: [
2049
- /* @__PURE__ */ t(
2050
- i,
2051
- {
2052
- sx: {
2053
- position: "absolute",
2054
- top: 0,
2055
- left: 0,
2056
- height: "100%",
2057
- width: `${a}%`,
2058
- bgcolor: s ? c.palette.primary.primaryContainer : o.mode === "light" ? "rgba(0, 0, 0, 0.1)" : "rgba(0, 0, 0, 0.2)",
2059
- transition: "width 0.8s ease-out",
2060
- zIndex: 0
2061
- }
2062
- }
2063
- ),
2064
- B()
2065
- ]
2066
- },
2067
- e.option.id
2068
- );
2069
- }, lt = (e) => {
2070
- const { t: n } = O(), a = ut(), l = Te(), o = D(), c = fe(), r = $e().size, f = e.options.reduce((m, d) => m + (d.votes || 0), 0);
2071
- if (e.optionsLayout === "twoByTwo") {
2072
- const m = [];
2073
- for (let d = 0; d < e.options.length; d += 2) {
2074
- const s = e.options.slice(d, d + 2);
2075
- m.push(s);
2076
- }
2077
- return /* @__PURE__ */ x(
2078
- i,
2079
- {
2080
- sx: { display: "flex", flexDirection: "column", gap: l.md },
2081
- children: [
2082
- /* @__PURE__ */ t(i, { sx: { py: 2, display: "flex", flexDirection: "column", gap: 2 }, children: m.map((d, s) => /* @__PURE__ */ t(
2083
- i,
2084
- {
2085
- sx: {
2086
- display: "flex",
2087
- flexDirection: {
2088
- xs: "column",
2089
- md: "row"
2090
- },
2091
- gap: 2
2092
- },
2093
- children: d.map((h) => /* @__PURE__ */ t(
2094
- Xe,
2095
- {
2096
- option: h,
2097
- optionsImages: e.optionsImages,
2098
- selectedOptions: e.selectedOptions,
2099
- brandingColors: e.brandingColors,
2100
- totalVotes: f
2101
- },
2102
- h.id
2103
- ))
2104
- },
2105
- `row-${s}`
2106
- )) }),
2107
- /* @__PURE__ */ x(
2108
- i,
2109
- {
2110
- sx: {
2111
- display: "flex",
2112
- alignItems: "center",
2113
- justifyContent: "center",
2114
- gap: l.xs,
2115
- pt: l.md,
2116
- borderTop: `${r} solid`,
2117
- borderColor: D().outlineEnabledBorder
2118
- },
2119
- children: [
2120
- /* @__PURE__ */ t(
2121
- je,
2122
- {
2123
- sx: {
2124
- fontSize: "1.2em",
2125
- color: o.textColor
2126
- }
2127
- }
2128
- ),
2129
- /* @__PURE__ */ x(
2130
- L,
2131
- {
2132
- level: "body-sm",
2133
- sx: {
2134
- color: o.textColor,
2135
- fontWeight: 500,
2136
- fontFamily: c.secondary,
2137
- fontSize: "0.875em"
2138
- },
2139
- children: [
2140
- f.toLocaleString(a),
2141
- " ",
2142
- n("poll.totalVotes")
2143
- ]
2144
- }
2145
- )
2146
- ]
2147
- }
2148
- )
2149
- ]
2150
- }
2151
- );
2152
- }
2153
- return e.optionsLayout === "column" ? /* @__PURE__ */ x(
2154
- i,
2155
- {
2156
- sx: { display: "flex", flexDirection: "column", gap: l.md },
2157
- children: [
2158
- /* @__PURE__ */ t(i, { sx: { py: 2, display: "flex", flexDirection: "column", gap: 2 }, children: e.options.map((m) => /* @__PURE__ */ t(
2159
- Xe,
2160
- {
2161
- option: m,
2162
- selectedOptions: e.selectedOptions,
2163
- optionsImages: e.optionsImages,
2164
- brandingColors: e.brandingColors,
2165
- totalVotes: f
2166
- },
2167
- m.id
2168
- )) }),
2169
- /* @__PURE__ */ x(
2170
- i,
2171
- {
2172
- sx: {
2173
- display: "flex",
2174
- alignItems: "center",
2175
- justifyContent: "center",
2176
- gap: l.xs,
2177
- pt: l.md,
2178
- borderTop: `${r} solid`,
2179
- borderColor: D().outlineEnabledBorder
2180
- },
2181
- children: [
2182
- /* @__PURE__ */ t(
2183
- je,
2184
- {
2185
- sx: {
2186
- fontSize: "1.2em",
2187
- color: o.textColor
2188
- }
2189
- }
2190
- ),
2191
- /* @__PURE__ */ x(
2192
- L,
2193
- {
2194
- level: "body-sm",
2195
- sx: {
2196
- color: o.textColor,
2197
- fontWeight: 500,
2198
- fontFamily: c.secondary,
2199
- fontSize: "0.875em"
2200
- },
2201
- children: [
2202
- f.toLocaleString(a),
2203
- " ",
2204
- n("poll.totalVotes")
2205
- ]
2206
- }
2207
- )
2208
- ]
2209
- }
2210
- )
2211
- ]
2212
- }
2213
- ) : /* @__PURE__ */ x(
2214
- i,
2215
- {
2216
- sx: { display: "flex", flexDirection: "column", gap: l.md },
2217
- children: [
2218
- /* @__PURE__ */ t(
2219
- i,
2220
- {
2221
- sx: {
2222
- py: 2,
2223
- display: "flex",
2224
- flexWrap: "wrap",
2225
- flexDirection: { xs: "column", md: "row" },
2226
- gap: 2
2227
- },
2228
- children: e.options.map((m) => /* @__PURE__ */ t(
2229
- Xe,
2230
- {
2231
- option: m,
2232
- selectedOptions: e.selectedOptions,
2233
- optionsImages: e.optionsImages,
2234
- brandingColors: e.brandingColors,
2235
- totalVotes: f
2236
- },
2237
- m.id
2238
- ))
2239
- }
2240
- ),
2241
- /* @__PURE__ */ x(
2242
- i,
2243
- {
2244
- sx: {
2245
- display: "flex",
2246
- alignItems: "center",
2247
- justifyContent: "center",
2248
- gap: l.xs,
2249
- pt: l.md,
2250
- borderTop: `${r} solid`,
2251
- borderColor: D().outlineEnabledBorder
2252
- },
2253
- children: [
2254
- /* @__PURE__ */ t(
2255
- je,
2256
- {
2257
- sx: {
2258
- fontSize: "1.2em",
2259
- color: o.textColor
2260
- }
2261
- }
2262
- ),
2263
- /* @__PURE__ */ x(
2264
- L,
2265
- {
2266
- level: "body-sm",
2267
- sx: {
2268
- color: o.textColor,
2269
- fontWeight: 500,
2270
- fontFamily: c.secondary,
2271
- fontSize: "0.875em"
2272
- },
2273
- children: [
2274
- f.toLocaleString(a),
2275
- " ",
2276
- n("poll.totalVotes")
2277
- ]
2278
- }
2279
- )
2280
- ]
2281
- }
2282
- )
2283
- ]
2284
- }
2285
- );
2286
- }, gn = (e) => {
2287
- var A, P, S, b;
2288
- const n = Ue(
2289
- {
2290
- images: e.poll.images,
2291
- imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
2292
- },
2293
- G.STANDARD
2294
- ), { optionsLayout: a } = Fe(Be), { t: l } = O(), o = ((A = e.poll.branding) == null ? void 0 : A.colors) || null, r = Q() ? ((P = e.poll.branding) == null ? void 0 : P.images.mobileLogo) || ((S = e.poll.branding) == null ? void 0 : S.images.mainLogo) || "" : ((b = e.poll.branding) == null ? void 0 : b.images.mainLogo) || "", u = e.imagePosition || "left", f = Oe(e.poll.options), m = (o == null ? void 0 : o.contentColor) || D().textColor, d = Te(), s = cn({
2295
- spacingScale: d,
2296
- textColor: m
2297
- }), h = () => {
2298
- var B, C, R, V, T;
2299
- return /* @__PURE__ */ t(v, { children: e.isUnauthorized ? /* @__PURE__ */ x(v, { children: [
2300
- /* @__PURE__ */ t(
2301
- nt,
2302
- {
2303
- variant: "error",
2304
- title: l("common.authentication.accessRequired"),
2305
- message: l("common.authentication.invalidOrMissingAuth")
2306
- }
2307
- ),
2308
- r ? /* @__PURE__ */ t(
2309
- W,
2310
- {
2311
- brandingLogo: r,
2312
- textColor: m,
2313
- label: ((T = e.poll.labels) == null ? void 0 : T.sponsor) || null
2314
- }
2315
- ) : /* @__PURE__ */ t(v, {})
2316
- ] }) : /* @__PURE__ */ x(v, { children: [
2317
- /* @__PURE__ */ t(i, { sx: s.questionArea, children: /* @__PURE__ */ t(i, { sx: s.questionContainer, children: /* @__PURE__ */ x(i, { sx: s.questionContentContainer, children: [
2318
- e.poll.alternativeTitle ? /* @__PURE__ */ t(i, { sx: s.alternativeTitleSection, children: /* @__PURE__ */ t(
2319
- L,
2320
- {
2321
- level: "body-lg",
2322
- sx: s.alternativeTitleText,
2323
- children: e.poll.alternativeTitle
2324
- }
2325
- ) }) : /* @__PURE__ */ t(v, {}),
2326
- /* @__PURE__ */ t(
2327
- lt,
2328
- {
2329
- options: e.poll.options,
2330
- selectedOptions: ((B = e.userVote) == null ? void 0 : B.optionIds) || [],
2331
- optionsLayout: a ?? "twoByTwo",
2332
- optionsImages: f,
2333
- brandingColors: ((C = e.poll.branding) == null ? void 0 : C.colors) || null
2334
- }
2335
- )
2336
- ] }) }) }),
2337
- e.chanceGameContent && /* @__PURE__ */ t(i, { sx: s.questionArea, children: e.chanceGameContent }),
2338
- /* @__PURE__ */ t(i, { sx: s.questionArea, children: /* @__PURE__ */ x(i, { sx: s.questionContainer, children: [
2339
- /* @__PURE__ */ x(
2340
- i,
2341
- {
2342
- sx: r ? s.footerContainer : s.footerContainerNoLogo,
2343
- children: [
2344
- r ? /* @__PURE__ */ t(i, { sx: s.presentedByDesktop, children: /* @__PURE__ */ t(
2345
- W,
2346
- {
2347
- brandingLogo: r,
2348
- textColor: m,
2349
- label: ((R = e.poll.labels) == null ? void 0 : R.sponsor) || null
2350
- }
2351
- ) }) : /* @__PURE__ */ t(v, {}),
2352
- /* @__PURE__ */ x(
2353
- i,
2354
- {
2355
- sx: {
2356
- display: "flex",
2357
- gap: "16px"
2358
- },
2359
- children: [
2360
- /* @__PURE__ */ t(
2361
- pe,
2362
- {
2363
- additionalCTA: e.additionalCTA,
2364
- buttonStyle: s.additionalCTAButton,
2365
- buttonContentStyle: s.additionalCTAButtonContent,
2366
- textStyle: s.additionalCTAText
2367
- }
2368
- ),
2369
- e.maxAttemptsReached ? /* @__PURE__ */ t(v, {}) : /* @__PURE__ */ t(
2370
- He,
2371
- {
2372
- sx: s.voteAgainButton,
2373
- onClick: e.voteAgain,
2374
- children: /* @__PURE__ */ x(i, { sx: s.playAgainButtonContent, children: [
2375
- /* @__PURE__ */ t(et, { sx: s.playAgainIcon }),
2376
- /* @__PURE__ */ t(L, { sx: s.playAgainText, children: l("poll.buttons.voteAgain") })
2377
- ] })
2378
- }
2379
- )
2380
- ]
2381
- }
2382
- )
2383
- ]
2384
- }
2385
- ),
2386
- r ? /* @__PURE__ */ t(i, { sx: s.presentedByMobile, children: /* @__PURE__ */ t(
2387
- W,
2388
- {
2389
- brandingLogo: r,
2390
- textColor: m,
2391
- label: ((V = e.poll.labels) == null ? void 0 : V.sponsor) || null
2392
- }
2393
- ) }) : /* @__PURE__ */ t(v, {})
2394
- ] }) })
2395
- ] }) });
2396
- };
2397
- return /* @__PURE__ */ t(ee, { brandingBorderColor: (o == null ? void 0 : o.borderColor) || null, children: /* @__PURE__ */ t(
2398
- Dt,
2399
- {
2400
- entity: e.poll,
2401
- headline: l("poll.headline"),
2402
- finalImage: n,
2403
- imagePosition: u,
2404
- rulesDisplay: e.rulesDisplay,
2405
- children: h()
2406
- }
2407
- ) });
2408
- }, mn = (e) => ({
2409
- // Question area content wrapper
2410
- questionAreaContent: {
2411
- p: e.spacingScale.lg,
2412
- display: "flex",
2413
- flexDirection: "column",
2414
- justifyContent: "center",
2415
- gap: e.spacingScale.lg,
2416
- flex: 1,
2417
- height: "100%"
2418
- },
2419
- // Alternative title section
2420
- alternativeTitleSection: {
2421
- gap: "8px",
2422
- display: "flex",
2423
- justifyContent: "center"
2424
- },
2425
- // Alternative title text
2426
- alternativeTitleText: {
2427
- fontFamily: e.fontFamilyPrimary,
2428
- lineHeight: "150%",
2429
- letterSpacing: "0.15px",
2430
- fontWeight: 500,
2431
- fontSize: "1.25em",
2432
- textAlign: "center",
2433
- color: e.textColor
2434
- },
2435
- // CTA container
2436
- ctaContainer: {
2437
- display: "flex",
2438
- flexDirection: "column",
2439
- alignItems: "center"
2440
- },
2441
- // CTA content wrapper
2442
- ctaContentWrapper: {
2443
- display: "flex",
2444
- flexDirection: "column",
2445
- justifyContent: "center",
2446
- alignItems: "center",
2447
- gap: e.spacingScale.lg
2448
- },
2449
- // Thanks for playing text
2450
- thanksText: {
2451
- color: e.textPrimary,
2452
- textAlign: "center",
2453
- fontFamily: e.fontFamilyPrimary,
2454
- fontSize: "1.25em",
2455
- fontStyle: "normal",
2456
- fontWeight: 500,
2457
- lineHeight: "120%",
2458
- letterSpacing: "0.15px"
2459
- },
2460
- // Buttons container
2461
- buttonsContainer: {
2462
- display: "flex",
2463
- flexDirection: "column",
2464
- gap: "16px"
2465
- },
2466
- // Play again button
2467
- playAgainButton: {
2468
- display: "flex",
2469
- py: e.spacingScale.xs,
2470
- px: "16px",
2471
- flexDirection: "column",
2472
- justifyContent: "center",
2473
- alignItems: "center",
2474
- gap: "8px",
2475
- borderRadius: e.borderRadius.xl,
2476
- color: e.textPrimary,
2477
- bgcolor: e.surfaceColor,
2478
- "&:hover": {
2479
- bgcolor: e.onSurfaceColor
2480
- },
2481
- fontSize: "0.9375em"
2482
- },
2483
- // Play again button content
2484
- playAgainButtonContent: {
2485
- display: "flex",
2486
- justifyContent: "center",
2487
- alignItems: "center",
2488
- gap: "8px",
2489
- alignSelf: "stretch"
2490
- },
2491
- // Play again icon
2492
- playAgainIcon: {
2493
- display: "flex",
2494
- width: "16px",
2495
- height: "16px",
2496
- justifyContent: "flex-end",
2497
- alignItems: "center",
2498
- color: e.textPrimary
2499
- },
2500
- // Play again text
2501
- playAgainText: {
2502
- color: e.textPrimary,
2503
- textAlign: "center",
2504
- fontFamily: e.fontFamilyPrimary,
2505
- fontSize: "0.9375em",
2506
- fontStyle: "normal",
2507
- fontWeight: 500,
2508
- lineHeight: "22px",
2509
- letterSpacing: "0.46px",
2510
- textTransform: "uppercase"
2511
- },
2512
- // Additional CTA button (secondary style)
2513
- additionalCTAButton: {
2514
- display: "flex",
2515
- py: e.spacingScale.xs,
2516
- px: e.spacingScale.md,
2517
- flexDirection: "column",
2518
- justifyContent: "center",
2519
- alignItems: "center",
2520
- gap: "8px",
2521
- borderRadius: e.borderRadius.xl,
2522
- bgcolor: e.secondaryContainer,
2523
- "&:hover": {
2524
- bgcolor: e.secondaryContainer,
2525
- opacity: 0.9
2526
- },
2527
- fontSize: "0.9375em"
2528
- },
2529
- // Additional CTA button content
2530
- additionalCTAButtonContent: {
2531
- display: "flex",
2532
- justifyContent: "center",
2533
- alignItems: "center",
2534
- gap: "8px"
2535
- },
2536
- // Additional CTA text
2537
- additionalCTAText: {
2538
- color: e.secondaryColor,
2539
- textAlign: "center",
2540
- fontFamily: e.fontFamilyPrimary,
2541
- fontSize: "0.9375em",
2542
- fontStyle: "normal",
2543
- fontWeight: 500,
2544
- lineHeight: "22px",
2545
- letterSpacing: "0.46px",
2546
- textTransform: "uppercase"
2547
- },
2548
- alertMessageArea: {
2549
- flex: e.isLarge ? "1" : "0 0 50%",
2550
- width: e.isLarge ? "100%" : "50%",
2551
- minWidth: e.isLarge ? "100%" : "50%",
2552
- maxWidth: e.isLarge ? "100%" : "50%",
2553
- display: "flex",
2554
- flexDirection: "column",
2555
- justifyContent: "center"
2556
- },
2557
- alertMessageWrapper: {
2558
- p: e.spacingScale.lg
2559
- }
2560
- }), un = (e) => {
2561
- var g, z, k, te;
2562
- const n = ve(), a = Q(), l = Rt(), o = Me(), c = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : a ? Ve : ze, r = Ue(
2563
- {
2564
- images: e.poll.images,
2565
- imagePlaceholder: c
2566
- },
2567
- G.SPLIT
2568
- ), u = Oe(e.poll.options), { t: f } = O(), { optionsLayout: m } = Fe(Be), d = ((g = e.poll.branding) == null ? void 0 : g.colors) || null, s = D().textPrimary, h = (d == null ? void 0 : d.secondaryColor) || D().textSecondary, A = D().secondaryContainer, P = fe().primary, S = (d == null ? void 0 : d.backgroundColor) || D().surfaceVariant, b = D().surface, B = D().onSurface, C = re(), R = D().textColor, V = Te(), T = a ? ((z = e.poll.branding) == null ? void 0 : z.images.mobileLogo) || ((k = e.poll.branding) == null ? void 0 : k.images.mainLogo) || "" : ((te = e.poll.branding) == null ? void 0 : te.images.mainLogo) || "", y = mn({
2569
- spacingScale: V,
2570
- borderRadius: C,
2571
- fontFamilyPrimary: P,
2572
- textPrimary: s,
2573
- secondaryColor: h,
2574
- secondaryContainer: A,
2575
- bgcolor: De(S || ""),
2576
- surfaceColor: b,
2577
- onSurfaceColor: B,
2578
- textColor: R,
2579
- darkTextColor: n.colorSchemes.dark.textColor,
2580
- isLarge: o
2581
- }), N = () => {
2582
- var w, _, M, Z;
2583
- const $ = l ? /* @__PURE__ */ t(
2584
- W,
2585
- {
2586
- brandingLogo: T,
2587
- textColor: (d == null ? void 0 : d.contentColor) || n.colorSchemes.dark.textColor,
2588
- label: ((w = e.poll.labels) == null ? void 0 : w.sponsor) || null
2589
- }
2590
- ) : null;
2591
- return /* @__PURE__ */ t(
2592
- Ft,
2593
- {
2594
- entity: e.poll,
2595
- headline: f("poll.headline"),
2596
- finalImage: r,
2597
- brandingContent: $,
2598
- isTabulated: !1,
2599
- alwaysShowImage: !0,
2600
- rulesDisplay: e.rulesDisplay,
2601
- children: e.isUnauthorized ? /* @__PURE__ */ t(i, { sx: y.alertMessageArea, children: /* @__PURE__ */ t(i, { sx: y.alertMessageWrapper, children: /* @__PURE__ */ t(
2602
- nt,
2603
- {
2604
- variant: "error",
2605
- title: f("common.authentication.accessRequired"),
2606
- message: f("common.authentication.invalidOrMissingAuth")
2607
- }
2608
- ) }) }) : /* @__PURE__ */ x(i, { sx: y.questionAreaContent, children: [
2609
- /* @__PURE__ */ x(
2610
- i,
2611
- {
2612
- sx: {
2613
- p: V.lg,
2614
- gap: V.lg,
2615
- display: "flex",
2616
- flexDirection: "column",
2617
- backdropFilter: "blur(4px)",
2618
- bgcolor: `rgba(${S ? De(S || "").replace(/[^\d,]/g, "") : ""}, 0.5)`,
2619
- borderRadius: C.sm
2620
- },
2621
- children: [
2622
- e.poll.alternativeTitle ? /* @__PURE__ */ t(i, { sx: y.alternativeTitleSection, children: /* @__PURE__ */ t(L, { level: "body-lg", sx: y.alternativeTitleText, children: e.poll.alternativeTitle }) }) : /* @__PURE__ */ t(v, {}),
2623
- /* @__PURE__ */ t(
2624
- lt,
2625
- {
2626
- options: e.poll.options,
2627
- selectedOptions: ((_ = e.userVote) == null ? void 0 : _.optionIds) || [],
2628
- optionsLayout: m ?? "twoByTwo",
2629
- optionsImages: u,
2630
- brandingColors: ((M = e.poll.branding) == null ? void 0 : M.colors) || null
2631
- }
2632
- )
2633
- ]
2634
- }
2635
- ),
2636
- !e.maxAttemptsReached || e.additionalCTA !== void 0 ? /* @__PURE__ */ t(
2637
- i,
2638
- {
2639
- id: "poll-desktop-thanks",
2640
- sx: {
2641
- p: V.lg,
2642
- gap: V.lg,
2643
- display: "flex",
2644
- flexDirection: "column",
2645
- backdropFilter: "blur(4px)",
2646
- bgcolor: `rgba(${S ? De(S || "").replace(/[^\d,]/g, "") : ""}, 0.5)`,
2647
- borderRadius: C.sm
2648
- },
2649
- children: /* @__PURE__ */ t(i, { sx: y.ctaContainer, children: /* @__PURE__ */ t(i, { sx: y.ctaContentWrapper, children: /* @__PURE__ */ x(i, { sx: y.buttonsContainer, children: [
2650
- !e.maxAttemptsReached && /* @__PURE__ */ t(
2651
- He,
2652
- {
2653
- sx: y.playAgainButton,
2654
- onClick: e.voteAgain,
2655
- children: /* @__PURE__ */ x(i, { sx: y.playAgainButtonContent, children: [
2656
- /* @__PURE__ */ t(et, { sx: y.playAgainIcon }),
2657
- /* @__PURE__ */ t(L, { sx: y.playAgainText, children: f("poll.buttons.voteAgain") })
2658
- ] })
2659
- }
2660
- ),
2661
- /* @__PURE__ */ t(
2662
- pe,
2663
- {
2664
- additionalCTA: e.additionalCTA,
2665
- buttonStyle: y.additionalCTAButton,
2666
- buttonContentStyle: y.additionalCTAButtonContent,
2667
- textStyle: y.additionalCTAText
2668
- }
2669
- )
2670
- ] }) }) })
2671
- }
2672
- ) : null,
2673
- e.chanceGameContent,
2674
- o && T && /* @__PURE__ */ t(
2675
- W,
2676
- {
2677
- brandingLogo: T,
2678
- textColor: (d == null ? void 0 : d.contentColor) || R,
2679
- label: ((Z = e.poll.labels) == null ? void 0 : Z.sponsor) || null,
2680
- isCentered: !0
2681
- }
2682
- )
2683
- ] })
2684
- }
2685
- );
2686
- };
2687
- return /* @__PURE__ */ t(ee, { brandingBorderColor: (d == null ? void 0 : d.borderColor) || null, children: N() });
2688
- }, fn = (e) => ({
2689
- // Main content wrapper
2690
- mainContentWrapper: {
2691
- display: "flex",
2692
- flexDirection: "column",
2693
- gap: "24px",
2694
- zIndex: 10
2695
- },
2696
- resultsContainer: {
2697
- borderRadius: e.mdBorderRadius,
2698
- p: e.spacingScale.md,
2699
- display: "flex",
2700
- flexDirection: "column",
2701
- alignItems: "center",
2702
- alignSelf: "stretch",
2703
- gap: e.spacingScale.md,
2704
- backdropFilter: "blur(4px)",
2705
- position: "relative",
2706
- "&::before": {
2707
- content: '""',
2708
- position: "absolute",
2709
- top: 0,
2710
- left: 0,
2711
- right: 0,
2712
- bottom: 0,
2713
- backgroundColor: e.contentBgColor,
2714
- opacity: 0.25,
2715
- borderRadius: "inherit",
2716
- zIndex: 0,
2717
- backdropFilter: "blur(4px)"
2718
- },
2719
- "& > *": {
2720
- position: "relative",
2721
- zIndex: 1
2722
- }
2723
- },
2724
- resultsWrapper: {
2725
- display: "flex",
2726
- flexDirection: "column",
2727
- justifyContent: "center",
2728
- alignItems: "center",
2729
- alignSelf: "stretch"
2730
- },
2731
- alternativeTitleSection: {
2732
- display: "flex",
2733
- gap: "8px",
2734
- alignItems: "flex-start",
2735
- justifyContent: "center"
2736
- },
2737
- alternativeTitleText: {
2738
- fontFamily: e.fontFamilyPrimary,
2739
- lineHeight: "150%",
2740
- letterSpacing: "0.15px",
2741
- fontWeight: 500,
2742
- fontSize: "1.25em",
2743
- textAlign: "center",
2744
- color: e.darkTextColor
2745
- },
2746
- ctaSection: {
2747
- borderRadius: e.mdBorderRadius,
2748
- py: e.spacingScale.md,
2749
- display: "flex",
2750
- flexDirection: "column",
2751
- alignItems: "center",
2752
- alignSelf: "stretch",
2753
- gap: e.spacingScale.md,
2754
- backdropFilter: "blur(4px)",
2755
- position: "relative",
2756
- "&::before": {
2757
- content: '""',
2758
- position: "absolute",
2759
- top: 0,
2760
- left: 0,
2761
- right: 0,
2762
- bottom: 0,
2763
- backgroundColor: e.contentBgColor,
2764
- opacity: 0.25,
2765
- borderRadius: "inherit",
2766
- zIndex: 0,
2767
- backdropFilter: "blur(4px)"
2768
- },
2769
- "& > *": {
2770
- position: "relative",
2771
- zIndex: 1
2772
- }
2773
- },
2774
- // Buttons container
2775
- buttonsContainer: {
2776
- display: "flex",
2777
- flexDirection: "column",
2778
- gap: e.spacingScale.md
2779
- },
2780
- // Play again button
2781
- playAgainButton: {
2782
- display: "flex",
2783
- minHeight: "48px",
2784
- py: "12px",
2785
- pr: "24px",
2786
- pl: "16px",
2787
- flexDirection: "column",
2788
- justifyContent: "center",
2789
- alignItems: "center",
2790
- gap: "8px",
2791
- borderRadius: e.xlBorderRadius,
2792
- bgcolor: e.onSurfaceColor,
2793
- "&:hover": {
2794
- bgcolor: e.surfaceVariantColor
2795
- },
2796
- fontSize: "0.9375em"
2797
- },
2798
- // Play again button content
2799
- playAgainButtonContent: {
2800
- display: "flex",
2801
- justifyContent: "center",
2802
- alignItems: "center",
2803
- gap: "8px",
2804
- alignSelf: "stretch"
2805
- },
2806
- // Play again icon
2807
- playAgainIcon: {
2808
- display: "flex",
2809
- width: "24px",
2810
- height: "24px",
2811
- justifyContent: "center",
2812
- alignItems: "center",
2813
- color: e.textPrimary
2814
- },
2815
- // Play again text
2816
- playAgainText: {
2817
- color: e.textPrimary,
2818
- textAlign: "center",
2819
- fontFamily: e.fontFamilyPrimary,
2820
- fontSize: "0.9375em",
2821
- fontStyle: "normal",
2822
- fontWeight: 500,
2823
- lineHeight: "24px",
2824
- letterSpacing: "0.46px",
2825
- textTransform: "uppercase"
2826
- },
2827
- // Additional CTA button (secondary style)
2828
- additionalCTAButton: {
2829
- display: "flex",
2830
- py: e.spacingScale.sm,
2831
- px: e.spacingScale.md,
2832
- flexDirection: "column",
2833
- justifyContent: "center",
2834
- alignItems: "center",
2835
- gap: "8px",
2836
- borderRadius: e.xlBorderRadius,
2837
- bgcolor: e.secondaryContainer,
2838
- "&:hover": {
2839
- bgcolor: e.secondaryContainer,
2840
- opacity: 0.9
2841
- },
2842
- fontSize: "0.9375em"
2843
- },
2844
- // Additional CTA button content
2845
- additionalCTAButtonContent: {
2846
- display: "flex",
2847
- justifyContent: "center",
2848
- alignItems: "center",
2849
- gap: "8px"
2850
- },
2851
- // Additional CTA text
2852
- additionalCTAText: {
2853
- color: e.secondaryColor,
2854
- fontFamily: e.fontFamilyPrimary,
2855
- fontSize: "0.9375em",
2856
- fontStyle: "normal",
2857
- fontWeight: 500,
2858
- lineHeight: "24px",
2859
- letterSpacing: "0.46px",
2860
- textTransform: "uppercase"
2861
- }
2862
- }), xn = (e) => {
2863
- const n = ve(), a = Te(), { t: l } = O(), o = Me(), c = mt(
2864
- G.OVERLAY
2865
- ), { optionsLayout: r } = Fe(Be), { brandingImage: u, brandingColors: f, brandingLogo: m } = Qe(e.poll.branding), d = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : Q() ? Ve : ze, s = u || Ue(
2866
- {
2867
- images: e.poll.images,
2868
- imagePlaceholder: d
2869
- },
2870
- G.OVERLAY
2871
- ), h = Bt(s), A = Oe(e.poll.options), P = (f == null ? void 0 : f.secondaryColor) || n.colorSchemes.dark.textSecondary, S = n.colorSchemes.dark.secondaryContainer, b = n.colorSchemes.dark.textPrimary, B = n.customFontFamily.light.primary, C = n.customRadius.light.md, R = n.customRadius.light.xl, V = (f == null ? void 0 : f.backgroundColor) || n.colorSchemes.dark.surfaceVariant, T = fn({
2872
- spacingScale: a,
2873
- secondaryColor: P,
2874
- secondaryContainer: S,
2875
- textPrimary: b,
2876
- fontFamilyPrimary: B,
2877
- mdBorderRadius: C,
2878
- xlBorderRadius: R,
2879
- contentBgColor: V,
2880
- onSurfaceColor: n.colorSchemes.dark.onSurface,
2881
- surfaceVariantColor: n.colorSchemes.dark.surfaceVariant,
2882
- darkTextColor: n.colorSchemes.dark.textColor
2883
- }), y = () => {
2884
- var N, g, z;
2885
- return /* @__PURE__ */ x(i, { sx: T.mainContentWrapper, children: [
2886
- e.isUnauthorized ? /* @__PURE__ */ t(v, { children: /* @__PURE__ */ t(
2887
- nt,
2888
- {
2889
- variant: "error",
2890
- title: l("common.authentication.accessRequired"),
2891
- message: l("common.authentication.invalidOrMissingAuth")
2892
- }
2893
- ) }) : /* @__PURE__ */ t(i, { sx: T.resultsContainer, children: /* @__PURE__ */ x(i, { sx: T.resultsWrapper, children: [
2894
- e.poll.alternativeTitle ? /* @__PURE__ */ t(i, { sx: T.alternativeTitleSection, children: /* @__PURE__ */ t(L, { level: "body-lg", sx: T.alternativeTitleText, children: e.poll.alternativeTitle }) }) : /* @__PURE__ */ t(v, {}),
2895
- /* @__PURE__ */ t(i, { sx: { width: "100%" }, children: /* @__PURE__ */ t(
2896
- lt,
2897
- {
2898
- options: e.poll.options,
2899
- selectedOptions: ((N = e.userVote) == null ? void 0 : N.optionIds) || [],
2900
- optionsLayout: o ? "column" : r ?? "row",
2901
- optionsImages: A,
2902
- brandingColors: ((g = e.poll.branding) == null ? void 0 : g.colors) || null
2903
- }
2904
- ) })
2905
- ] }) }),
2906
- (!e.maxAttemptsReached || e.additionalCTA !== void 0) && /* @__PURE__ */ t(i, { sx: T.ctaSection, children: /* @__PURE__ */ x(i, { sx: T.buttonsContainer, children: [
2907
- !e.maxAttemptsReached && /* @__PURE__ */ t(He, { sx: T.playAgainButton, onClick: e.voteAgain, children: /* @__PURE__ */ x(i, { sx: T.playAgainButtonContent, children: [
2908
- /* @__PURE__ */ t(et, { sx: T.playAgainIcon }),
2909
- /* @__PURE__ */ t(L, { sx: T.playAgainText, children: l("poll.buttons.voteAgain") })
2910
- ] }) }),
2911
- /* @__PURE__ */ t(
2912
- pe,
2913
- {
2914
- additionalCTA: e.additionalCTA,
2915
- buttonStyle: T.additionalCTAButton,
2916
- buttonContentStyle: T.additionalCTAButtonContent,
2917
- textStyle: T.additionalCTAText
2918
- }
2919
- )
2920
- ] }) }),
2921
- e.chanceGameContent,
2922
- /* @__PURE__ */ t(
2923
- W,
2924
- {
2925
- brandingLogo: m,
2926
- textColor: n.colorSchemes.dark.textColor,
2927
- label: ((z = e.poll.labels) == null ? void 0 : z.sponsor) || null
2928
- }
2929
- )
2930
- ] });
2931
- };
2932
- return /* @__PURE__ */ t(
2933
- Vt,
2934
- {
2935
- entity: e.poll,
2936
- headline: l("poll.headline"),
2937
- backgroundImage: h,
2938
- imageBackgroundGradient: c,
2939
- rulesDisplay: e.rulesDisplay,
2940
- children: y()
2941
- }
2942
- );
2943
- }, yn = () => {
2944
- const { t: e } = O();
2945
- return /* @__PURE__ */ t(ee, { brandingBorderColor: null, children: /* @__PURE__ */ t(
2946
- zt,
2947
- {
2948
- notFoundTitle: e("poll.pollNotFound"),
2949
- notFoundMessage: e("poll.pollNotFoundDescription")
2950
- }
2951
- ) });
2952
- }, hn = ({
2953
- poll: e,
2954
- template: n,
2955
- imagePosition: a,
2956
- defaultImagePlaceholderUrl: l,
2957
- rulesDisplay: o
2958
- }) => {
2959
- var s;
2960
- const { t: c } = O(), r = Q(), u = ((s = e.branding) == null ? void 0 : s.colors) || null, { brandingLogo: f } = Qe(
2961
- e.branding || null
2962
- ), m = (h) => {
2963
- var A;
2964
- return /* @__PURE__ */ t(
2965
- W,
2966
- {
2967
- brandingLogo: f,
2968
- textColor: h,
2969
- label: ((A = e.labels) == null ? void 0 : A.sponsor) || null
2970
- }
2971
- );
2972
- }, d = {
2973
- entity: e,
2974
- headline: c("poll.headline"),
2975
- tryAgainButtonText: "",
2976
- isApiError: !1,
2977
- alertVariant: "neutral",
2978
- customAlertTitle: c("poll.gameNotAvailable"),
2979
- customAlertMessage: c("poll.gameNotAvailableDescription"),
2980
- renderPresentedBy: m,
2981
- rulesDisplay: o
2982
- };
2983
- return n === G.OVERLAY ? /* @__PURE__ */ t(
2984
- ft,
2985
- {
2986
- ...d,
2987
- defaultImagePlaceholderUrl: l || (r ? Ve : ze)
2988
- }
2989
- ) : n === G.SPLIT ? /* @__PURE__ */ t(ee, { brandingBorderColor: (u == null ? void 0 : u.borderColor) || null, children: /* @__PURE__ */ t(
2990
- xt,
2991
- {
2992
- ...d,
2993
- defaultImagePlaceholderUrl: l
2994
- }
2995
- ) }) : /* @__PURE__ */ t(ee, { brandingBorderColor: (u == null ? void 0 : u.borderColor) || null, children: /* @__PURE__ */ t(
2996
- yt,
2997
- {
2998
- ...d,
2999
- imagePosition: a || "left",
3000
- defaultImagePlaceholderUrl: l
3001
- }
3002
- ) });
3003
- }, bn = (e) => {
3004
- var o, c, r, u;
3005
- const n = ((o = e.poll.branding) == null ? void 0 : o.colors) || null, a = Q() ? ((c = e.poll.branding) == null ? void 0 : c.images.mobileLogo) || ((r = e.poll.branding) == null ? void 0 : r.images.mainLogo) || "" : ((u = e.poll.branding) == null ? void 0 : u.images.mainLogo) || "", { t: l } = O();
3006
- return /* @__PURE__ */ t(ee, { brandingBorderColor: (n == null ? void 0 : n.borderColor) || null, children: /* @__PURE__ */ t(
3007
- yt,
3008
- {
3009
- entity: e.poll,
3010
- headline: l("poll.headline"),
3011
- tryAgainButtonText: l("poll.buttons.tryAgain"),
3012
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3013
- imagePosition: e.imagePosition || "left",
3014
- isApiError: e.isApiError,
3015
- apiErrorMessage: e.apiErrorMessage,
3016
- toggleTryAgain: e.toggleTryAgain,
3017
- rulesDisplay: e.rulesDisplay,
3018
- renderPresentedBy: (f) => {
3019
- var m;
3020
- return /* @__PURE__ */ t(
3021
- W,
3022
- {
3023
- brandingLogo: a,
3024
- textColor: f,
3025
- label: ((m = e.poll.labels) == null ? void 0 : m.sponsor) || null
3026
- }
3027
- );
3028
- }
3029
- }
3030
- ) });
3031
- }, Cn = (e) => {
3032
- var c, r, u, f;
3033
- const n = Q(), { t: a } = O(), l = ((c = e.poll.branding) == null ? void 0 : c.colors) || null, o = n ? ((r = e.poll.branding) == null ? void 0 : r.images.mobileLogo) || ((u = e.poll.branding) == null ? void 0 : u.images.mainLogo) || "" : ((f = e.poll.branding) == null ? void 0 : f.images.mainLogo) || "";
3034
- return console.log("defaultImagePlaceholderUrl", e.defaultImagePlaceholderUrl), /* @__PURE__ */ t(ee, { brandingBorderColor: (l == null ? void 0 : l.borderColor) || null, children: /* @__PURE__ */ t(
3035
- xt,
3036
- {
3037
- entity: e.poll,
3038
- headline: a("poll.headline"),
3039
- tryAgainButtonText: a("poll.buttons.tryAgain"),
3040
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3041
- isApiError: e.isApiError,
3042
- apiErrorMessage: e.apiErrorMessage,
3043
- toggleTryAgain: e.toggleTryAgain,
3044
- rulesDisplay: e.rulesDisplay,
3045
- renderPresentedBy: (m) => {
3046
- var d;
3047
- return /* @__PURE__ */ t(
3048
- W,
3049
- {
3050
- brandingLogo: o,
3051
- textColor: m,
3052
- label: ((d = e.poll.labels) == null ? void 0 : d.sponsor) || null
3053
- }
3054
- );
3055
- }
3056
- }
3057
- ) });
3058
- }, Sn = (e) => {
3059
- const { t: n } = O(), a = Q(), l = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : a ? Ve : ze, { brandingLogo: o } = Qe(
3060
- e.poll.branding || null
3061
- );
3062
- return /* @__PURE__ */ t(
3063
- ft,
3064
- {
3065
- entity: e.poll,
3066
- headline: n("poll.headline"),
3067
- tryAgainButtonText: n("poll.buttons.tryAgain"),
3068
- defaultImagePlaceholderUrl: l,
3069
- isApiError: e.isApiError,
3070
- apiErrorMessage: e.apiErrorMessage,
3071
- toggleTryAgain: e.toggleTryAgain,
3072
- rulesDisplay: e.rulesDisplay,
3073
- renderPresentedBy: (c) => {
3074
- var r;
3075
- return /* @__PURE__ */ t(
3076
- W,
3077
- {
3078
- brandingLogo: o,
3079
- textColor: c,
3080
- label: ((r = e.poll.labels) == null ? void 0 : r.sponsor) || null
3081
- }
3082
- );
3083
- }
3084
- }
3085
- );
3086
- }, In = (e) => {
3087
- const { t: n } = O();
3088
- return /* @__PURE__ */ t(
3089
- ht,
3090
- {
3091
- entity: e.poll,
3092
- headline: n("poll.headline"),
3093
- sdk: e.sdk,
3094
- leads: e.leads,
3095
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3096
- imagePosition: e.imagePosition,
3097
- onLeadSubmitted: e.onLeadSubmitted,
3098
- isSubmitting: e.isSubmitting,
3099
- MainCard: ee,
3100
- PresentedBy: W,
3101
- CollectLeadWrapper: We,
3102
- consents: e.consents
3103
- }
3104
- );
3105
- }, Pn = (e) => {
3106
- const { t: n } = O();
3107
- return /* @__PURE__ */ t(
3108
- bt,
3109
- {
3110
- entity: e.poll,
3111
- headline: n("poll.headline"),
3112
- sdk: e.sdk,
3113
- leads: e.leads,
3114
- defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
3115
- onLeadSubmitted: e.onLeadSubmitted,
3116
- isSubmitting: e.isSubmitting,
3117
- MainCard: ee,
3118
- PresentedBy: W,
3119
- CollectLeadWrapper: We,
3120
- consents: e.consents
3121
- }
3122
- );
3123
- }, Tn = (e) => {
3124
- const { t: n } = O();
3125
- return /* @__PURE__ */ t(
3126
- Ct,
3127
- {
3128
- entity: e.poll,
3129
- headline: n("poll.headline"),
3130
- sdk: e.sdk,
3131
- leads: e.leads,
3132
- defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
3133
- onLeadSubmitted: e.onLeadSubmitted,
3134
- isSubmitting: e.isSubmitting,
3135
- PresentedBy: W,
3136
- CollectLeadWrapper: We,
3137
- consents: e.consents
3138
- }
3139
- );
3140
- }, An = (e) => {
3141
- var o, c, r;
3142
- const { t: n } = O(), a = ((o = e.poll.branding) == null ? void 0 : o.colors) || null, l = (a == null ? void 0 : a.primaryColor) || D().palette.primary.plainColor;
3143
- return /* @__PURE__ */ t(
3144
- ht,
3145
- {
3146
- entity: e.poll,
3147
- headline: n("poll.headline"),
3148
- sdk: e.sdk,
3149
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3150
- imagePosition: e.imagePosition,
3151
- onLeadSubmitted: e.onSubmit,
3152
- isSubmitting: e.isSubmitting,
3153
- MainCard: ee,
3154
- PresentedBy: W,
3155
- rulesDisplay: e.rulesDisplay,
3156
- content: /* @__PURE__ */ t(
3157
- Ee,
3158
- {
3159
- consents: e.consents,
3160
- primaryColor: l,
3161
- brandingUrls: (c = e.poll.branding) == null ? void 0 : c.urls,
3162
- align: "center"
3163
- }
3164
- ),
3165
- footerAction: /* @__PURE__ */ t(
3166
- _e,
3167
- {
3168
- onClick: e.onSubmit,
3169
- label: ((r = e.consents.labels) == null ? void 0 : r.ctaLabel) || n("poll.buttons.vote"),
3170
- isSubmitting: e.isSubmitting,
3171
- primaryColor: l,
3172
- showArrow: !1
3173
- }
3174
- )
3175
- }
3176
- );
3177
- }, vn = (e) => {
3178
- var o, c;
3179
- const { t: n } = O(), a = ((o = e.poll.branding) == null ? void 0 : o.colors) || null, l = (a == null ? void 0 : a.primaryColor) || D().palette.primary.plainColor;
3180
- return /* @__PURE__ */ t(
3181
- bt,
3182
- {
3183
- entity: e.poll,
3184
- headline: n("poll.headline"),
3185
- sdk: e.sdk,
3186
- defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
3187
- onLeadSubmitted: e.onSubmit,
3188
- isSubmitting: e.isSubmitting,
3189
- MainCard: ee,
3190
- PresentedBy: W,
3191
- rulesDisplay: e.rulesDisplay,
3192
- content: /* @__PURE__ */ t(
3193
- Ee,
3194
- {
3195
- consents: e.consents,
3196
- primaryColor: l,
3197
- brandingUrls: (c = e.poll.branding) == null ? void 0 : c.urls,
3198
- onSubmit: e.onSubmit,
3199
- isSubmitting: e.isSubmitting,
3200
- ctaLabel: n("poll.buttons.vote"),
3201
- showArrow: !1,
3202
- align: "center"
3203
- }
3204
- )
3205
- }
3206
- );
3207
- }, Ln = (e) => {
3208
- var c, r, u;
3209
- const { t: n } = O(), a = ve(), l = ((c = e.poll.branding) == null ? void 0 : c.colors) || null, o = (l == null ? void 0 : l.primaryColor) || a.colorSchemes.dark.palette.primary.plainColor;
3210
- return /* @__PURE__ */ t(
3211
- Ct,
3212
- {
3213
- entity: e.poll,
3214
- headline: n("poll.headline"),
3215
- sdk: e.sdk,
3216
- defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
3217
- onLeadSubmitted: e.onSubmit,
3218
- isSubmitting: e.isSubmitting,
3219
- PresentedBy: W,
3220
- rulesDisplay: e.rulesDisplay,
3221
- content: /* @__PURE__ */ t(
3222
- Ee,
3223
- {
3224
- consents: e.consents,
3225
- primaryColor: o,
3226
- textColor: (l == null ? void 0 : l.contentColor) || a.colorSchemes.dark.textColor,
3227
- brandingUrls: (r = e.poll.branding) == null ? void 0 : r.urls
3228
- }
3229
- ),
3230
- footerAction: /* @__PURE__ */ t(
3231
- _e,
3232
- {
3233
- onClick: e.onSubmit,
3234
- label: ((u = e.consents.labels) == null ? void 0 : u.ctaLabel) || n("poll.buttons.vote"),
3235
- isSubmitting: e.isSubmitting,
3236
- primaryColor: o,
3237
- showArrow: !1
3238
- }
3239
- )
3240
- }
3241
- );
3242
- };
3243
- function we(e) {
3244
- return e.template === G.STANDARD;
3245
- }
3246
- const kn = (e) => {
3247
- var it, at;
3248
- const [n, a] = U([]), [l, o] = U(!1), [c, r] = U(!1), [u, f] = U(!1), [m, d] = U(!1), [s, h] = U(!1), [A, P] = U(!1), [S, b] = U(!1), [B, C] = U(!1), [R, V] = U(!1), [T, y] = U(!1), N = Ht(!1), { poll: g, setPoll: z } = Jt(e.entityId, e.sdk), {
3249
- myVote: k,
3250
- setMyVote: te,
3251
- isUnauthorized: $,
3252
- isApiError: w,
3253
- apiErrorMessage: _,
3254
- setIsApiError: M,
3255
- setApiErrorMessage: Z,
3256
- setIsUnauthorized: ce
3257
- } = Xt(
3258
- e.entityId,
3259
- e.sdk,
3260
- u,
3261
- // A REGISTERED poll now renders for anonymous users, so its 401 is expected.
3262
- (g == null ? void 0 : g.authRequirement) === "REGISTERED" && !e.userIsLoggedIn,
3263
- !!e.userIsLoggedIn
3264
- ), K = Ke(() => !g || !k || !(k != null && k.id) || g.maxAttempts === -1 || g.maxAttempts === null || k.attempts === null ? !1 : (g == null ? void 0 : g.maxAttempts) <= (k == null ? void 0 : k.attempts), [g, k]), {
3265
- translations: ne,
3266
- loaded: xe,
3267
- loadTranslations: se
3268
- } = en(g, e.sdk), le = !!e.aggregateTranslatedVotes && K && !xe;
3269
- ke(() => {
3270
- le && se();
3271
- }, [le]);
3272
- const de = Ke(() => !g || !ne.length ? null : pt(g.options, ne), [g, ne]), p = Ke(() => g ? Ut(g.related) : null, [g]), {
3273
- loading: oe,
3274
- pending: H,
3275
- checked: ye,
3276
- setChecked: he,
3277
- allRequiredChecked: ge,
3278
- submit: me
3279
- } = Et({
3280
- sdk: e.sdk,
3281
- consents: (it = e.consents) == null ? void 0 : it.items,
3282
- entityId: e.entityId,
3283
- entityType: "poll"
3284
- }), q = !!((g == null ? void 0 : g.authRequirement) === "LEAD" ? (at = e.leads) == null ? void 0 : at.position : void 0) && H.length > 0, j = q ? [] : H.filter((I) => I.position !== "after"), Y = q ? [] : H.filter((I) => I.position === "after"), be = (I) => {
3285
- he(I), y(!1);
3286
- };
3287
- if (ke(() => {
3288
- Wt(e.language || "en");
3289
- }, [e.language]), ke(() => {
3290
- var F;
3291
- if (!g || oe || N.current) return;
3292
- const I = g.authRequirement === "LEAD" && ((F = e.leads) == null ? void 0 : F.position) === "before";
3293
- b(!I && j.length > 0);
3294
- }, [g, oe, j.length]), ke(() => {
3295
- var I, F;
3296
- !l || !(k != null && k.id) || (F = (I = e.callbacks) == null ? void 0 : I.onFinish) == null || F.call(I, k);
3297
- }, [l]), !g || !k || oe || le)
3298
- return /* @__PURE__ */ t(Ot, { my: 20 });
3299
- if (!g.id)
3300
- return /* @__PURE__ */ t(yn, {});
3301
- if (g.status !== "ACTIVE")
3302
- return /* @__PURE__ */ t(
3303
- hn,
3304
- {
3305
- poll: g,
3306
- template: e.template,
3307
- imagePosition: we(e) ? e.imagePosition : void 0,
3308
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3309
- rulesDisplay: e.rulesDisplay
3310
- }
3311
- );
3312
- const ie = g.authRequirement === "REGISTERED" && !e.userIsLoggedIn, Ce = () => {
3313
- M(!1), Z(""), ce(!1), f(!u);
3314
- };
3315
- if ($ || w)
3316
- return we(e) ? /* @__PURE__ */ t(
3317
- bn,
3318
- {
3319
- poll: g,
3320
- imagePosition: e.imagePosition,
3321
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3322
- isApiError: w,
3323
- apiErrorMessage: _,
3324
- toggleTryAgain: Ce,
3325
- rulesDisplay: e.rulesDisplay
3326
- }
3327
- ) : e.template === G.OVERLAY ? /* @__PURE__ */ t(
3328
- Sn,
3329
- {
3330
- poll: g,
3331
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3332
- isApiError: w,
3333
- apiErrorMessage: _,
3334
- toggleTryAgain: Ce,
3335
- rulesDisplay: e.rulesDisplay
3336
- }
3337
- ) : /* @__PURE__ */ t(
3338
- Cn,
3339
- {
3340
- poll: g,
3341
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3342
- isApiError: w,
3343
- apiErrorMessage: _,
3344
- toggleTryAgain: Ce,
3345
- rulesDisplay: e.rulesDisplay
3346
- }
3347
- );
3348
- const ue = g.multipleChoice && g.maxMultipleChoiceOptions || 1, X = (I) => {
3349
- if (ue === 1)
3350
- a(I);
3351
- else {
3352
- const F = I[0];
3353
- a((E) => E.includes(F) ? E.filter((qe) => qe !== F) : E.length < ue ? [...E, F] : E);
3354
- }
3355
- }, Ae = async () => {
3356
- var I;
3357
- if (Y.length > 0 && !R) {
3358
- C(!0);
3359
- return;
3360
- }
3361
- if (((I = e.leads) == null ? void 0 : I.position) === "after" && g.authRequirement === "LEAD" && !s) {
3362
- P(!0);
3363
- return;
3364
- }
3365
- await Se();
3366
- }, ae = async () => {
3367
- if (j.length > 0) {
3368
- if (m) return;
3369
- if (!ge(j)) {
3370
- y(!0);
3371
- return;
3372
- }
3373
- d(!0), await me(j), d(!1);
3374
- }
3375
- N.current = !0, b(!1);
3376
- }, Le = async () => {
3377
- if (!ge(Y)) {
3378
- y(!0);
3379
- return;
3380
- }
3381
- d(!0), await me(Y), V(!0), await Se(), d(!1), C(!1);
3382
- }, Se = async () => {
3383
- r(!0);
3384
- try {
3385
- const I = await e.sdk.voting.voteForPoll(
3386
- e.entityId,
3387
- n
3388
- ), F = { ...g };
3389
- F.options = g.options.map((E) => n.includes(E.id) ? {
3390
- ...E,
3391
- votes: E.votes + 1
3392
- } : E), F.totalVotes = (g.totalVotes || 0) + n.length, e.aggregateTranslatedVotes && await se(), z(F), te(I), o(!0);
3393
- } catch (I) {
3394
- console.error("[poll-vote] vote failed", I);
3395
- const { code: F, message: E } = qt(I, e.sdk);
3396
- F === 401 || F === 403 ? ce(!0) : (M(!0), Z(E));
3397
- } finally {
3398
- r(!1);
3399
- }
3400
- }, Ie = async () => {
3401
- h(!0), d(!0), await Se(), d(!1), P(!1);
3402
- }, Pe = () => {
3403
- o(!1), a([]), d(!1), h(!1), P(!1), C(!1), y(!1);
3404
- }, ot = (I) => {
3405
- var F;
3406
- return {
3407
- items: I,
3408
- checked: ye,
3409
- onChange: be,
3410
- labels: (F = e.consents) == null ? void 0 : F.labels,
3411
- showError: T
3412
- };
3413
- }, St = () => {
3414
- const I = ot(j), F = q ? H : void 0, E = Y.length > 0 && !R;
3415
- return e.template === G.OVERLAY ? /* @__PURE__ */ t(
3416
- nn,
3417
- {
3418
- sdk: e.sdk,
3419
- leads: e.leads,
3420
- poll: g,
3421
- options: g.options,
3422
- selectedOptions: n,
3423
- answerPoll: X,
3424
- voteForPoll: Ae,
3425
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3426
- optionChoices: ue,
3427
- isVoting: c,
3428
- rulesDisplay: e.rulesDisplay,
3429
- consents: I,
3430
- leadConsents: F,
3431
- applyConsentGate: S,
3432
- isSubmitting: m,
3433
- hasAfterConsents: E,
3434
- startVoting: ae,
3435
- signInRequired: ie,
3436
- signInCTA: e.signInCTA
3437
- }
3438
- ) : we(e) ? /* @__PURE__ */ t(
3439
- on,
3440
- {
3441
- sdk: e.sdk,
3442
- leads: e.leads,
3443
- poll: g,
3444
- options: g.options,
3445
- selectedOptions: n,
3446
- answerPoll: X,
3447
- voteForPoll: Ae,
3448
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3449
- imagePosition: e.imagePosition,
3450
- optionChoices: ue,
3451
- isVoting: c,
3452
- rulesDisplay: e.rulesDisplay,
3453
- consents: I,
3454
- leadConsents: F,
3455
- applyConsentGate: S,
3456
- isSubmitting: m,
3457
- hasAfterConsents: E,
3458
- startVoting: ae,
3459
- signInRequired: ie,
3460
- signInCTA: e.signInCTA
3461
- }
3462
- ) : /* @__PURE__ */ t(
3463
- rn,
3464
- {
3465
- sdk: e.sdk,
3466
- leads: e.leads,
3467
- poll: g,
3468
- options: g.options,
3469
- selectedOptions: n,
3470
- answerPoll: X,
3471
- voteForPoll: Ae,
3472
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3473
- optionChoices: ue,
3474
- isVoting: c,
3475
- rulesDisplay: e.rulesDisplay,
3476
- consents: I,
3477
- leadConsents: F,
3478
- applyConsentGate: S,
3479
- isSubmitting: m,
3480
- hasAfterConsents: E,
3481
- startVoting: ae,
3482
- signInRequired: ie,
3483
- signInCTA: e.signInCTA
3484
- }
3485
- );
3486
- };
3487
- if (B && Y.length > 0) {
3488
- const I = {
3489
- poll: g,
3490
- sdk: e.sdk,
3491
- consents: ot(Y),
3492
- onSubmit: Le,
3493
- isSubmitting: m,
3494
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3495
- rulesDisplay: e.rulesDisplay
3496
- };
3497
- return e.template === G.OVERLAY ? /* @__PURE__ */ t(Ln, { ...I }) : we(e) ? /* @__PURE__ */ t(
3498
- An,
3499
- {
3500
- ...I,
3501
- imagePosition: e.imagePosition
3502
- }
3503
- ) : /* @__PURE__ */ t(vn, { ...I });
3504
- }
3505
- if (A)
3506
- return e.template === G.OVERLAY ? /* @__PURE__ */ t(
3507
- Tn,
3508
- {
3509
- poll: g,
3510
- sdk: e.sdk,
3511
- leads: e.leads,
3512
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3513
- onLeadSubmitted: Ie,
3514
- isSubmitting: m,
3515
- consents: q ? H : void 0
3516
- }
3517
- ) : we(e) ? /* @__PURE__ */ t(
3518
- In,
3519
- {
3520
- poll: g,
3521
- sdk: e.sdk,
3522
- leads: e.leads,
3523
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3524
- imagePosition: e.imagePosition,
3525
- onLeadSubmitted: Ie,
3526
- isSubmitting: m,
3527
- consents: q ? H : void 0
3528
- }
3529
- ) : /* @__PURE__ */ t(
3530
- Pn,
3531
- {
3532
- poll: g,
3533
- sdk: e.sdk,
3534
- leads: e.leads,
3535
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3536
- onLeadSubmitted: Ie,
3537
- isSubmitting: m,
3538
- consents: q ? H : void 0
3539
- }
3540
- );
3541
- if (l || K) {
3542
- const I = de ? { ...g, options: de } : g, F = p ? /* @__PURE__ */ t(ct, { entityId: p, sdk: e.sdk, children: (qe) => /* @__PURE__ */ t(
3543
- st,
3544
- {
3545
- infoPage: qe,
3546
- variant: e.chanceGameVariant
3547
- }
3548
- ) }) : void 0, E = p ? /* @__PURE__ */ t(ct, { entityId: p, sdk: e.sdk, children: (qe) => /* @__PURE__ */ t(
3549
- st,
3550
- {
3551
- infoPage: qe,
3552
- variant: e.chanceGameVariant,
3553
- forceMobile: !0
3554
- }
3555
- ) }) : void 0;
3556
- return e.template === G.OVERLAY ? /* @__PURE__ */ t(
3557
- xn,
3558
- {
3559
- userVote: k,
3560
- poll: I,
3561
- maxAttemptsReached: K,
3562
- voteAgain: Pe,
3563
- sdk: e.sdk,
3564
- leads: e.leads,
3565
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3566
- isUnauthorized: $,
3567
- additionalCTA: e.additionalCTA,
3568
- rulesDisplay: e.rulesDisplay,
3569
- chanceGameContent: F
3570
- }
3571
- ) : we(e) ? /* @__PURE__ */ t(
3572
- gn,
3573
- {
3574
- imagePosition: e.imagePosition || "left",
3575
- userVote: k,
3576
- poll: I,
3577
- maxAttemptsReached: K,
3578
- voteAgain: Pe,
3579
- sdk: e.sdk,
3580
- leads: e.leads,
3581
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3582
- isUnauthorized: $,
3583
- additionalCTA: e.additionalCTA,
3584
- rulesDisplay: e.rulesDisplay,
3585
- chanceGameContent: E
3586
- }
3587
- ) : /* @__PURE__ */ t(
3588
- un,
3589
- {
3590
- userVote: k,
3591
- poll: I,
3592
- maxAttemptsReached: K,
3593
- voteAgain: Pe,
3594
- sdk: e.sdk,
3595
- leads: e.leads,
3596
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3597
- isUnauthorized: $,
3598
- additionalCTA: e.additionalCTA,
3599
- rulesDisplay: e.rulesDisplay,
3600
- chanceGameContent: E
3601
- }
3602
- );
3603
- }
3604
- return St();
3605
- }, jn = (e) => /* @__PURE__ */ t(jt, { packageName: "poll-vote", ...e, children: /* @__PURE__ */ t(kn, { ...e }) });
3606
- export {
3607
- jn as M
3608
- };