@micromag/screen-urbania-recommendation 0.3.541 → 0.3.547

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 (3) hide show
  1. package/es/index.js +2 -3
  2. package/package.json +15 -16
  3. package/lib/index.js +0 -721
package/es/index.js CHANGED
@@ -547,7 +547,6 @@ var UrbaniaRecommendation = function UrbaniaRecommendation(_ref) {
547
547
  };
548
548
  UrbaniaRecommendation.propTypes = propTypes;
549
549
  UrbaniaRecommendation.defaultProps = defaultProps;
550
- var UrbaniaRecommendation$1 = UrbaniaRecommendation;
551
550
 
552
551
  var definition = [{
553
552
  id: 'urbania-recommendation',
@@ -570,7 +569,7 @@ var definition = [{
570
569
  "value": "Urbania recommendation"
571
570
  }]
572
571
  }),
573
- component: UrbaniaRecommendation$1,
572
+ component: UrbaniaRecommendation,
574
573
  layouts: ['top', 'bottom'],
575
574
  fields: [{
576
575
  name: 'layout',
@@ -713,4 +712,4 @@ var definition = [{
713
712
  }]
714
713
  }];
715
714
 
716
- export { UrbaniaRecommendation$1 as UrbaniaRecommendation, definition as default };
715
+ export { UrbaniaRecommendation, definition as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-urbania-recommendation",
3
- "version": "0.3.541",
3
+ "version": "0.3.547",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -30,12 +30,11 @@
30
30
  }
31
31
  ],
32
32
  "license": "ISC",
33
- "main": "lib/index.js",
33
+ "type": "module",
34
34
  "module": "es/index.js",
35
35
  "style": "assets/css/styles.css",
36
36
  "exports": {
37
37
  ".": {
38
- "require": "./lib/index.js",
39
38
  "import": "./es/index.js"
40
39
  },
41
40
  "./assets/css/styles": "./assets/css/styles.css",
@@ -61,18 +60,18 @@
61
60
  },
62
61
  "dependencies": {
63
62
  "@babel/runtime": "^7.13.10",
64
- "@micromag/core": "^0.3.541",
65
- "@micromag/element-background": "^0.3.541",
66
- "@micromag/element-button": "^0.3.541",
67
- "@micromag/element-container": "^0.3.541",
68
- "@micromag/element-footer": "^0.3.541",
69
- "@micromag/element-header": "^0.3.541",
70
- "@micromag/element-heading": "^0.3.541",
71
- "@micromag/element-layout": "^0.3.541",
72
- "@micromag/element-scroll": "^0.3.541",
73
- "@micromag/element-text": "^0.3.541",
74
- "@micromag/element-visual": "^0.3.541",
75
- "@micromag/transforms": "^0.3.541",
63
+ "@micromag/core": "^0.3.547",
64
+ "@micromag/element-background": "^0.3.547",
65
+ "@micromag/element-button": "^0.3.547",
66
+ "@micromag/element-container": "^0.3.547",
67
+ "@micromag/element-footer": "^0.3.547",
68
+ "@micromag/element-header": "^0.3.547",
69
+ "@micromag/element-heading": "^0.3.547",
70
+ "@micromag/element-layout": "^0.3.547",
71
+ "@micromag/element-scroll": "^0.3.547",
72
+ "@micromag/element-text": "^0.3.547",
73
+ "@micromag/element-visual": "^0.3.547",
74
+ "@micromag/transforms": "^0.3.547",
76
75
  "classnames": "^2.2.6",
77
76
  "lodash": "^4.17.21",
78
77
  "prop-types": "^15.7.2",
@@ -83,5 +82,5 @@
83
82
  "access": "public",
84
83
  "registry": "https://registry.npmjs.org/"
85
84
  },
86
- "gitHead": "6c04a7e327b5fbc096785c11320b3fbd3c5751c8"
85
+ "gitHead": "3c2f5904ce61fcfa61f673c38c2a5ec56e9e2b07"
87
86
  }
package/lib/index.js DELETED
@@ -1,721 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var reactIntl = require('react-intl');
6
- var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
7
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
8
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
9
- var classNames = require('classnames');
10
- var PropTypes = require('prop-types');
11
- var React = require('react');
12
- var core = require('@micromag/core');
13
- var components = require('@micromag/core/components');
14
- var contexts = require('@micromag/core/contexts');
15
- var hooks = require('@micromag/core/hooks');
16
- var utils = require('@micromag/core/utils');
17
- var Background = require('@micromag/element-background');
18
- var Button = require('@micromag/element-button');
19
- var Container = require('@micromag/element-container');
20
- var Footer = require('@micromag/element-footer');
21
- var Header = require('@micromag/element-header');
22
- var Heading = require('@micromag/element-heading');
23
- var Layout = require('@micromag/element-layout');
24
- var Scroll = require('@micromag/element-scroll');
25
- var Text = require('@micromag/element-text');
26
- var Visual = require('@micromag/element-visual');
27
-
28
- var styles = {"container":"micromag-screen-urbania-recommendation-container","visualButton":"micromag-screen-urbania-recommendation-visualButton","close":"micromag-screen-urbania-recommendation-close","backgroundTextContainer":"micromag-screen-urbania-recommendation-backgroundTextContainer","background":"micromag-screen-urbania-recommendation-background","disabled":"micromag-screen-urbania-recommendation-disabled","hidden":"micromag-screen-urbania-recommendation-hidden","placeholder":"micromag-screen-urbania-recommendation-placeholder","content":"micromag-screen-urbania-recommendation-content","emptyCategory":"micromag-screen-urbania-recommendation-emptyCategory","empty":"micromag-screen-urbania-recommendation-empty","emptyText":"micromag-screen-urbania-recommendation-emptyText","backgroundText":"micromag-screen-urbania-recommendation-backgroundText","didAnimate":"micromag-screen-urbania-recommendation-didAnimate","animateFromBottom":"micromag-screen-urbania-recommendation-animateFromBottom","slideFromBottom":"micromag-screen-urbania-recommendation-slideFromBottom","animateFromTop":"micromag-screen-urbania-recommendation-animateFromTop","slideFromTop":"micromag-screen-urbania-recommendation-slideFromTop","emptyVisual":"micromag-screen-urbania-recommendation-emptyVisual","emptySponsor":"micromag-screen-urbania-recommendation-emptySponsor","footer":"micromag-screen-urbania-recommendation-footer","closeIcon":"micromag-screen-urbania-recommendation-closeIcon","textCard":"micromag-screen-urbania-recommendation-textCard","isPlaceholder":"micromag-screen-urbania-recommendation-isPlaceholder","appear":"micromag-screen-urbania-recommendation-appear","visualContainer":"micromag-screen-urbania-recommendation-visualContainer","visualBottom":"micromag-screen-urbania-recommendation-visualBottom","modalOpened":"micromag-screen-urbania-recommendation-modalOpened","sponsor":"micromag-screen-urbania-recommendation-sponsor","hasVisual":"micromag-screen-urbania-recommendation-hasVisual","sponsorPlaceholder":"micromag-screen-urbania-recommendation-sponsorPlaceholder","visualWrapper":"micromag-screen-urbania-recommendation-visualWrapper","transitioning":"micromag-screen-urbania-recommendation-transitioning","iconContainer":"micromag-screen-urbania-recommendation-iconContainer","icon":"micromag-screen-urbania-recommendation-icon","text":"micromag-screen-urbania-recommendation-text","categoryContainer":"micromag-screen-urbania-recommendation-categoryContainer","category":"micromag-screen-urbania-recommendation-category","categoryPlaceholder":"micromag-screen-urbania-recommendation-categoryPlaceholder","textContent":"micromag-screen-urbania-recommendation-textContent","titleContainer":"micromag-screen-urbania-recommendation-titleContainer","title":"micromag-screen-urbania-recommendation-title","date":"micromag-screen-urbania-recommendation-date","location":"micromag-screen-urbania-recommendation-location","description":"micromag-screen-urbania-recommendation-description","descriptionPlaceholder":"micromag-screen-urbania-recommendation-descriptionPlaceholder","layout":"micromag-screen-urbania-recommendation-layout"};
29
-
30
- var propTypes = {
31
- layout: PropTypes.string,
32
- category: core.PropTypes.headingElement,
33
- visual: PropTypes.shape({
34
- image: core.PropTypes.visualElement
35
- }),
36
- title: core.PropTypes.headingElement,
37
- date: core.PropTypes.textElement,
38
- location: core.PropTypes.textElement,
39
- description: core.PropTypes.textElement,
40
- sponsor: core.PropTypes.textElement,
41
- spacing: PropTypes.number,
42
- header: core.PropTypes.header,
43
- footer: core.PropTypes.footer,
44
- background: core.PropTypes.backgroundElement,
45
- current: PropTypes.bool,
46
- active: PropTypes.bool,
47
- className: PropTypes.string
48
- };
49
- var defaultProps = {
50
- layout: null,
51
- category: null,
52
- visual: null,
53
- title: null,
54
- date: null,
55
- location: null,
56
- description: null,
57
- sponsor: null,
58
- spacing: 20,
59
- header: null,
60
- footer: null,
61
- background: null,
62
- current: true,
63
- active: true,
64
- className: null
65
- };
66
- var UrbaniaRecommendation = function UrbaniaRecommendation(_ref) {
67
- var layout = _ref.layout,
68
- category = _ref.category,
69
- visual = _ref.visual,
70
- title = _ref.title,
71
- date = _ref.date,
72
- location = _ref.location,
73
- description = _ref.description,
74
- sponsor = _ref.sponsor,
75
- spacing = _ref.spacing,
76
- header = _ref.header,
77
- footer = _ref.footer,
78
- background = _ref.background,
79
- current = _ref.current,
80
- active = _ref.active,
81
- className = _ref.className;
82
- var intl = reactIntl.useIntl();
83
- var trackScreenEvent = hooks.useTrackScreenEvent();
84
- var _useScreenSize = contexts.useScreenSize(),
85
- width = _useScreenSize.width,
86
- height = _useScreenSize.height,
87
- resolution = _useScreenSize.resolution;
88
- var _useViewerContext = contexts.useViewerContext(),
89
- viewerTopHeight = _useViewerContext.topHeight,
90
- viewerBottomHeight = _useViewerContext.bottomHeight,
91
- viewerBottomSidesWidth = _useViewerContext.bottomSidesWidth;
92
- var _useViewerWebView = contexts.useViewerWebView(),
93
- openWebView = _useViewerWebView.open;
94
- var _usePlaybackContext = contexts.usePlaybackContext(),
95
- playing = _usePlaybackContext.playing,
96
- setPlaying = _usePlaybackContext.setPlaying,
97
- muted = _usePlaybackContext.muted,
98
- setMuted = _usePlaybackContext.setMuted,
99
- setControls = _usePlaybackContext.setControls,
100
- showControls = _usePlaybackContext.showControls,
101
- hideControls = _usePlaybackContext.hideControls;
102
- var mediaRef = contexts.usePlaybackMediaRef(current);
103
- var _useViewerInteraction = contexts.useViewerInteraction(),
104
- enableInteraction = _useViewerInteraction.enableInteraction,
105
- disableInteraction = _useViewerInteraction.disableInteraction;
106
- var _useScreenRenderConte = contexts.useScreenRenderContext(),
107
- isView = _useScreenRenderConte.isView,
108
- isPreview = _useScreenRenderConte.isPreview,
109
- isPlaceholder = _useScreenRenderConte.isPlaceholder,
110
- isEdit = _useScreenRenderConte.isEdit,
111
- isStatic = _useScreenRenderConte.isStatic;
112
- var animateBackground = current && !isPlaceholder && !isStatic && !isPreview && !isEdit;
113
- var _useState = React.useState(animateBackground),
114
- _useState2 = _slicedToArray(_useState, 2),
115
- backgroundAnimationStarted = _useState2[0],
116
- setBackgroundAnimationStarted = _useState2[1];
117
- var _useState3 = React.useState(false),
118
- _useState4 = _slicedToArray(_useState3, 2),
119
- didAnimate = _useState4[0],
120
- setDidAnimate = _useState4[1];
121
- var _ref2 = visual || {},
122
- _ref2$image = _ref2.image,
123
- image = _ref2$image === void 0 ? null : _ref2$image; // note: image can be a video
124
- var _ref3 = image || {},
125
- _ref3$type = _ref3.type,
126
- type = _ref3$type === void 0 ? null : _ref3$type,
127
- _ref3$metadata = _ref3.metadata,
128
- videoMetadata = _ref3$metadata === void 0 ? null : _ref3$metadata;
129
- var _ref4 = videoMetadata || {},
130
- _ref4$width = _ref4.width,
131
- videoWidth = _ref4$width === void 0 ? 0 : _ref4$width,
132
- _ref4$height = _ref4.height,
133
- videoHeight = _ref4$height === void 0 ? 0 : _ref4$height;
134
- var hasVisual = image !== null;
135
- var isVideo = type === 'video';
136
- var isVideoLandscape = hasVisual && isVideo && videoWidth > videoHeight;
137
- var hasCategory = utils.isTextFilled(category);
138
- var hasTitle = utils.isTextFilled(title);
139
- var hasDate = utils.isTextFilled(date);
140
- var hasLocation = utils.isTextFilled(location);
141
- var hasDescription = utils.isTextFilled(description);
142
- var hasSponsor = utils.isTextFilled(sponsor);
143
- var hasTextCard = hasCategory || hasTitle || hasDate || hasLocation || hasDescription || hasSponsor;
144
- var backgroundPlaying = current && (isView || isEdit);
145
- var videoPlaying = current && (isView || isEdit) && playing;
146
- var mediaShouldLoad = current || active;
147
- var scrollingDisabled = !isView && !isEdit || !current;
148
- var hasHeader = utils.isHeaderFilled(header);
149
- var hasFooter = utils.isFooterFilled(footer);
150
- var footerProps = utils.getFooterProps(footer, {
151
- isView: isView,
152
- current: current,
153
- openWebView: openWebView,
154
- isPreview: isPreview
155
- });
156
- var _useState5 = React.useState(false),
157
- _useState6 = _slicedToArray(_useState5, 2),
158
- scrolledBottom = _useState6[0],
159
- setScrolledBottom = _useState6[1];
160
- var _useResizeObserver = hooks.useResizeObserver(),
161
- textContainerRef = _useResizeObserver.ref,
162
- _useResizeObserver$en = _useResizeObserver.entry.contentRect,
163
- textContainerRect = _useResizeObserver$en === void 0 ? null : _useResizeObserver$en;
164
- var _ref5 = textContainerRect || {},
165
- _ref5$width = _ref5.width,
166
- textContainerWidth = _ref5$width === void 0 ? 0 : _ref5$width,
167
- _ref5$height = _ref5.height,
168
- textContainerHeight = _ref5$height === void 0 ? 0 : _ref5$height;
169
- var _useState7 = React.useState(false),
170
- _useState8 = _slicedToArray(_useState7, 2),
171
- visualModalTransitioning = _useState8[0],
172
- setVisualModalTransitioning = _useState8[1];
173
- var _useState9 = React.useState(false),
174
- _useState10 = _slicedToArray(_useState9, 2),
175
- visualModalOpened = _useState10[0],
176
- setVisualModalOpened = _useState10[1];
177
- var visualModalClosed = !visualModalTransitioning && !visualModalOpened;
178
- var _ref6 = background || {},
179
- _ref6$text = _ref6.text,
180
- backgroundText = _ref6$text === void 0 ? null : _ref6$text;
181
- var _ref7 = backgroundText || {},
182
- _ref7$body = _ref7.body,
183
- backgroundTextBody = _ref7$body === void 0 ? null : _ref7$body,
184
- backgroundTextStyle = _ref7.textStyle;
185
- var finalBackgroundText = React.useMemo(function () {
186
- function distributeTextEqually(text) {
187
- var words = text !== null ? text.split(' ') : [];
188
- var numRows = 4;
189
- if (words.length < numRows / 2) {
190
- return Array(numRows).fill(text);
191
- }
192
- var halfNumWords = Math.ceil(words.length / 2);
193
- var firstHalf = words.slice(0, halfNumWords).join(' ');
194
- var secondHalf = words.slice(halfNumWords).join(' ');
195
- return [firstHalf, secondHalf, firstHalf, secondHalf];
196
- }
197
- var textArray = distributeTextEqually(backgroundTextBody);
198
-
199
- // @TODO: move container div here to avoid double map
200
- var textElements = (textArray || []).map(function (line) {
201
- return /*#__PURE__*/React.createElement("span", null, line);
202
- });
203
- return textElements;
204
- }, [backgroundTextBody]);
205
-
206
- // intro animation
207
- React.useEffect(function () {
208
- var id = null;
209
- if (backgroundAnimationStarted) {
210
- id = setTimeout(function () {
211
- setBackgroundAnimationStarted(false);
212
- setDidAnimate(true);
213
- }, 1600);
214
- }
215
- return function () {
216
- clearTimeout(id);
217
- };
218
- }, [backgroundAnimationStarted, animateBackground, setDidAnimate, setBackgroundAnimationStarted]);
219
- React.useEffect(function () {
220
- if (isView && !isStatic && current) {
221
- setBackgroundAnimationStarted(true);
222
- } else {
223
- setBackgroundAnimationStarted(false);
224
- }
225
- }, [isView, current, setBackgroundAnimationStarted]);
226
-
227
- // scroll events
228
- var onScrolledBottom = React.useCallback(function (_ref8) {
229
- var initial = _ref8.initial;
230
- if (initial) {
231
- trackScreenEvent('scroll', 'Screen');
232
- }
233
- setScrolledBottom(true);
234
- }, [trackScreenEvent]);
235
- var onScrolledNotBottom = React.useCallback(function () {
236
- setScrolledBottom(false);
237
- }, [setScrolledBottom]);
238
-
239
- // modal
240
- React.useEffect(function () {
241
- var id = null;
242
- if (visualModalTransitioning) {
243
- id = setTimeout(function () {
244
- setVisualModalTransitioning(false);
245
- setVisualModalOpened(true);
246
- }, 400);
247
- }
248
- if (!current) {
249
- setVisualModalOpened(false);
250
- }
251
- return function () {
252
- clearTimeout(id);
253
- };
254
- }, [visualModalTransitioning, setVisualModalTransitioning, current]);
255
- var onClickVisual = React.useCallback(function () {
256
- if (!visualModalOpened) {
257
- setVisualModalTransitioning(true);
258
- }
259
- if (muted && isVideo) {
260
- setMuted(false);
261
- }
262
- }, [setVisualModalOpened]);
263
- var onCloseModal = React.useCallback(function () {
264
- if (visualModalTransitioning) {
265
- setVisualModalTransitioning(false);
266
- }
267
- setVisualModalOpened(false);
268
- }, [setVisualModalOpened]);
269
- React.useEffect(function () {
270
- if (visualModalOpened) {
271
- disableInteraction();
272
- } else {
273
- enableInteraction();
274
- }
275
- }, [current, visualModalOpened]);
276
- React.useEffect(function () {
277
- var keyup = function keyup(e) {
278
- if (e.key === 'Escape') {
279
- if (visualModalOpened) {
280
- onCloseModal();
281
- }
282
- }
283
- };
284
- document.addEventListener('keyup', keyup);
285
- return function () {
286
- document.removeEventListener('keyup', keyup);
287
- };
288
- }, [visualModalOpened, onCloseModal]);
289
-
290
- // Modal video
291
-
292
- React.useEffect(function () {
293
- if (current && !backgroundAnimationStarted) {
294
- setPlaying(true);
295
- }
296
- }, [current, backgroundAnimationStarted]);
297
- React.useEffect(function () {
298
- if (!current) {
299
- return function () {};
300
- }
301
- if (visualModalOpened && isVideo) {
302
- setControls(true);
303
- } else {
304
- setControls(false);
305
- }
306
- return function () {
307
- if (visualModalOpened) {
308
- setControls(false);
309
- }
310
- };
311
- }, [current, setControls, visualModalOpened, isVideo]);
312
- var viewerContainer = contexts.useViewerContainer();
313
- var _useActivityDetector = hooks.useActivityDetector({
314
- element: viewerContainer,
315
- disabled: !isView,
316
- timeout: 2000
317
- }),
318
- activityDetected = _useActivityDetector.detected;
319
- var toggleControlsVisibility = React.useCallback(function () {
320
- if (activityDetected && isVideo && visualModalOpened) {
321
- showControls();
322
- } else {
323
- hideControls();
324
- }
325
- }, [activityDetected, showControls, isVideo, hideControls]);
326
- hooks.useDebounce(toggleControlsVisibility, activityDetected, 1000);
327
- return /*#__PURE__*/React.createElement("div", {
328
- className: classNames([styles.container, _defineProperty(_defineProperty({}, className, className !== null), styles.isPlaceholder, isPlaceholder)]),
329
- "data-screen-ready": true
330
- }, /*#__PURE__*/React.createElement(Container, {
331
- width: width,
332
- height: height,
333
- className: styles.content
334
- }, /*#__PURE__*/React.createElement(Scroll, {
335
- width: width,
336
- height: height,
337
- disabled: backgroundAnimationStarted || scrollingDisabled,
338
- onScrolledBottom: onScrolledBottom,
339
- onScrolledNotBottom: onScrolledNotBottom,
340
- verticalAlign: "middle",
341
- withShadow: !visualModalOpened,
342
- withArrow: !visualModalOpened
343
- }, /*#__PURE__*/React.createElement(Layout, {
344
- className: styles.layout,
345
- width: width
346
- // height={height}
347
- ,
348
- style: !isPlaceholder ? {
349
- padding: spacing,
350
- paddingTop: (!isPreview ? viewerTopHeight : 0) + spacing / 2,
351
- paddingBottom: (current && !isPreview ? viewerBottomHeight : 0) + spacing / 2,
352
- minHeight: height // probably not the best
353
- } : null
354
- }, !isPlaceholder && hasHeader ? /*#__PURE__*/React.createElement("div", {
355
- key: "header",
356
- style: {
357
- paddingBottom: spacing
358
- },
359
- className: classNames([styles.headerContainer])
360
- }, /*#__PURE__*/React.createElement(Header, header)) : null, !isPlaceholder ? /*#__PURE__*/React.createElement(Layout.Spacer, {
361
- key: "spacer-cta-top"
362
- }) : null, visualModalOpened ? /*#__PURE__*/React.createElement(Button, {
363
- className: styles.close,
364
- onClick: onCloseModal
365
- }, /*#__PURE__*/React.createElement(components.Close, {
366
- className: styles.closeIcon
367
- })) : null, hasTextCard || isPlaceholder || isEdit ? /*#__PURE__*/React.createElement(Container, {
368
- className: classNames([styles.textCard, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.isPlaceholder, isPlaceholder), styles.visualBottom, layout === 'bottom'), styles.appear, backgroundAnimationStarted), styles.modalOpened, visualModalTransitioning || visualModalOpened), styles.hidden, !current && isView && !isPreview)])
369
- }, /*#__PURE__*/React.createElement("div", {
370
- className: classNames([styles.visualContainer, _defineProperty({}, styles.modalOpened, visualModalTransitioning || visualModalOpened)])
371
- }, /*#__PURE__*/React.createElement(components.ScreenElement, {
372
- key: "visual",
373
- placeholder: /*#__PURE__*/React.createElement(components.PlaceholderImage, {
374
- className: styles.visualPlaceholder
375
- }),
376
- emptyLabel: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
377
- id: "JzSBzL",
378
- defaultMessage: [{
379
- "type": 0,
380
- "value": "Visual"
381
- }]
382
- }),
383
- emptyClassName: classNames([styles.empty, styles.emptyVisual]),
384
- isEmpty: !hasVisual
385
- }, hasVisual ? /*#__PURE__*/React.createElement("div", {
386
- className: classNames([styles.visualWrapper, _defineProperty({}, styles.modalOpened, visualModalTransitioning || visualModalOpened)]),
387
- style: visualModalTransitioning || visualModalOpened ? {
388
- width: width,
389
- height: height
390
- } : {
391
- width: textContainerWidth,
392
- height: 'auto'
393
- }
394
- }, /*#__PURE__*/React.createElement(Button, {
395
- className: classNames([styles.visualButton, _defineProperty({}, styles.transitioning, visualModalTransitioning)]),
396
- onClick: onClickVisual,
397
- disabled: isPreview || backgroundAnimationStarted || visualModalOpened,
398
- focusable: current && !isPreview && !visualModalOpened,
399
- "aria-label": intl.formatMessage({
400
- id: "XHO5Ua",
401
- defaultMessage: [{
402
- "type": 0,
403
- "value": "Expand visual"
404
- }]
405
- }),
406
- "aria-pressed": visualModalOpened,
407
- style: {
408
- transform: visualModalTransitioning ? "scale(".concat(width / textContainerWidth, ")") : null
409
- }
410
- }, isVideo ? /*#__PURE__*/React.createElement(Visual, {
411
- media: image,
412
- mediaRef: mediaRef,
413
- width: visualModalTransitioning || visualModalOpened ? width : (width - 40) * 0.9 + 1 // ((width - margins) * card width + gapfix )
414
- ,
415
- height: visualModalTransitioning || visualModalOpened ? height : 250,
416
- resolution: resolution,
417
- objectFit: {
418
- fit: (visualModalTransitioning || visualModalOpened) && isVideoLandscape ? 'contain' : 'cover'
419
- },
420
- shouldLoad: mediaShouldLoad,
421
- muted: muted || !visualModalOpened,
422
- withoutVideo: isPreview,
423
- playing: videoPlaying
424
- }) : /*#__PURE__*/React.createElement(Visual, {
425
- media: image,
426
- width: visualModalOpened ? width : textContainerWidth,
427
- resolution: resolution,
428
- active: active,
429
- shouldLoad: mediaShouldLoad
430
- }), visualModalClosed ? /*#__PURE__*/React.createElement("div", {
431
- className: classNames([styles.iconContainer, _defineProperty({}, styles.visualBottom, layout === 'bottom')])
432
- }, isVideo ? /*#__PURE__*/React.createElement(components.MuteIcon, {
433
- color: "#000",
434
- className: styles.icon
435
- }) : /*#__PURE__*/React.createElement(components.FullscreenIcon, {
436
- color: "#000",
437
- className: styles.icon
438
- })) : null)) : null), /*#__PURE__*/React.createElement(components.ScreenElement, {
439
- key: "sponsor",
440
- placeholder: /*#__PURE__*/React.createElement(components.PlaceholderText, {
441
- className: styles.sponsorPlaceholder
442
- })
443
- }, hasSponsor ? /*#__PURE__*/React.createElement(Text, Object.assign({
444
- className: classNames([styles.sponsor, _defineProperty({}, styles.hasVisual, hasVisual)])
445
- }, sponsor)) : null)), /*#__PURE__*/React.createElement("div", {
446
- ref: textContainerRef,
447
- className: styles.text
448
- }, /*#__PURE__*/React.createElement(components.ScreenElement, {
449
- key: "category",
450
- placeholder: /*#__PURE__*/React.createElement(components.PlaceholderTitle, {
451
- className: styles.categoryPlaceholder
452
- }),
453
- emptyLabel: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
454
- id: "I5+AHN",
455
- defaultMessage: [{
456
- "type": 0,
457
- "value": "Category"
458
- }]
459
- }),
460
- emptyClassName: styles.emptyCategory,
461
- isEmpty: !hasCategory
462
- }, hasCategory ? /*#__PURE__*/React.createElement("div", {
463
- className: styles.categoryContainer,
464
- style: {
465
- width: textContainerHeight
466
- }
467
- }, /*#__PURE__*/React.createElement(Heading, Object.assign({
468
- className: styles.category
469
- }, category))) : null), /*#__PURE__*/React.createElement("div", {
470
- className: classNames([styles.textContent, _defineProperty({}, styles.isPlaceholder, isPlaceholder)])
471
- }, /*#__PURE__*/React.createElement(components.ScreenElement, {
472
- key: "title",
473
- placeholder: "title",
474
- emptyLabel: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
475
- id: "2c1WFV",
476
- defaultMessage: [{
477
- "type": 0,
478
- "value": "Title"
479
- }]
480
- }),
481
- emptyClassName: styles.emptyText,
482
- isEmpty: !hasTitle
483
- }, hasTitle ? /*#__PURE__*/React.createElement("div", {
484
- className: styles.titleContainer
485
- }, /*#__PURE__*/React.createElement(Heading, Object.assign({
486
- className: styles.title
487
- }, title))) : null), /*#__PURE__*/React.createElement(components.ScreenElement, {
488
- key: "date",
489
- placeholder: /*#__PURE__*/React.createElement(components.PlaceholderText, {
490
- className: styles.datePlaceholder
491
- })
492
- }, hasDate ? /*#__PURE__*/React.createElement(Text, Object.assign({
493
- className: styles.date
494
- }, date)) : null), /*#__PURE__*/React.createElement(components.ScreenElement, {
495
- key: "location",
496
- placeholder: /*#__PURE__*/React.createElement(components.PlaceholderText, {
497
- className: styles.locationPlaceholder
498
- })
499
- }, hasLocation ? /*#__PURE__*/React.createElement(Text, Object.assign({
500
- className: styles.location
501
- }, location)) : null), /*#__PURE__*/React.createElement(components.ScreenElement, {
502
- key: "description",
503
- placeholder: /*#__PURE__*/React.createElement(components.PlaceholderText, {
504
- className: styles.descriptionPlaceholder
505
- }),
506
- emptyLabel: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
507
- id: "EQdIAR",
508
- defaultMessage: [{
509
- "type": 0,
510
- "value": "Description"
511
- }]
512
- }),
513
- emptyClassName: styles.emptyText,
514
- isEmpty: !hasDescription
515
- }, hasDescription ? /*#__PURE__*/React.createElement(Text, Object.assign({
516
- className: styles.description
517
- }, description)) : null)))) : null, !isPlaceholder ? /*#__PURE__*/React.createElement(Layout.Spacer, {
518
- key: "spacer-cta-bottom"
519
- }) : null, !isPlaceholder && hasFooter ? /*#__PURE__*/React.createElement("div", {
520
- key: "footer",
521
- className: classNames([styles.footer, _defineProperty({}, styles.disabled, !scrolledBottom && !visualModalOpened)]),
522
- style: {
523
- paddingTop: spacing,
524
- paddingLeft: Math.max(0, viewerBottomSidesWidth - spacing),
525
- paddingRight: Math.max(0, viewerBottomSidesWidth - spacing)
526
- }
527
- }, /*#__PURE__*/React.createElement(Footer, footerProps)) : null))), !isPlaceholder ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Background, {
528
- background: background,
529
- width: width,
530
- height: height,
531
- resolution: resolution,
532
- playing: backgroundPlaying && !visualModalOpened,
533
- muted: muted || visualModalOpened,
534
- shouldLoad: mediaShouldLoad,
535
- mediaRef: mediaRef,
536
- withoutVideo: isPreview,
537
- className: styles.background
538
- }), backgroundText !== null && finalBackgroundText.length > 0 ? /*#__PURE__*/React.createElement(Container, {
539
- width: width,
540
- height: height,
541
- className: styles.backgroundTextContainer
542
- }, (finalBackgroundText || []).map(function (line, i) {
543
- return /*#__PURE__*/React.createElement("div", {
544
- key: "reco-background-text-".concat(i + 1),
545
- className: classNames([styles.backgroundText], _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.hidden, !current && isView && !isPreview), styles.didAnimate, didAnimate), styles.animateFromBottom, backgroundAnimationStarted && i % 2 !== 0), styles.animateFromTop, backgroundAnimationStarted && i % 2 === 0)),
546
- style: _objectSpread({
547
- animationDelay: "".concat(i * 100, "ms")
548
- }, utils.getStyleFromText(backgroundTextStyle))
549
- }, line);
550
- })) : null) : null);
551
- };
552
- UrbaniaRecommendation.propTypes = propTypes;
553
- UrbaniaRecommendation.defaultProps = defaultProps;
554
- var UrbaniaRecommendation$1 = UrbaniaRecommendation;
555
-
556
- var definition = [{
557
- id: 'urbania-recommendation',
558
- type: 'screen',
559
- namespaces: ['urbania', 'bayard'],
560
- group: {
561
- label: reactIntl.defineMessage({
562
- id: "oPjl8f",
563
- defaultMessage: [{
564
- "type": 0,
565
- "value": "Urbania"
566
- }]
567
- }),
568
- order: 10
569
- },
570
- title: reactIntl.defineMessage({
571
- id: "sUP5BO",
572
- defaultMessage: [{
573
- "type": 0,
574
- "value": "Urbania recommendation"
575
- }]
576
- }),
577
- component: UrbaniaRecommendation$1,
578
- layouts: ['top', 'bottom'],
579
- fields: [{
580
- name: 'layout',
581
- type: 'screen-layout',
582
- label: reactIntl.defineMessage({
583
- id: "4iBXj2",
584
- defaultMessage: [{
585
- "type": 0,
586
- "value": "Layout"
587
- }]
588
- })
589
- }, {
590
- name: 'sponsor',
591
- type: 'text-element',
592
- label: reactIntl.defineMessage({
593
- id: "WY14Zu",
594
- defaultMessage: [{
595
- "type": 0,
596
- "value": "Sponsor"
597
- }]
598
- })
599
- }, {
600
- name: 'visual',
601
- type: 'fields',
602
- isList: true,
603
- label: reactIntl.defineMessage({
604
- id: "HwqzVR",
605
- defaultMessage: [{
606
- "type": 0,
607
- "value": "Visual"
608
- }]
609
- }),
610
- fields: [{
611
- name: 'image',
612
- type: 'visual',
613
- label: reactIntl.defineMessage({
614
- id: "xT/onn",
615
- defaultMessage: [{
616
- "type": 0,
617
- "value": "Image"
618
- }]
619
- })
620
- }]
621
- }, {
622
- name: 'category',
623
- type: 'heading-element',
624
- label: reactIntl.defineMessage({
625
- id: "4grcMU",
626
- defaultMessage: [{
627
- "type": 0,
628
- "value": "Category"
629
- }]
630
- })
631
- }, {
632
- name: 'title',
633
- type: 'heading-element',
634
- label: reactIntl.defineMessage({
635
- id: "N25iDO",
636
- defaultMessage: [{
637
- "type": 0,
638
- "value": "Title"
639
- }]
640
- })
641
- }, {
642
- name: 'date',
643
- type: 'text-element',
644
- label: reactIntl.defineMessage({
645
- id: "yEG9zh",
646
- defaultMessage: [{
647
- "type": 0,
648
- "value": "Date"
649
- }]
650
- })
651
- }, {
652
- name: 'location',
653
- type: 'text-element',
654
- label: reactIntl.defineMessage({
655
- id: "zLxBdl",
656
- defaultMessage: [{
657
- "type": 0,
658
- "value": "Location"
659
- }]
660
- })
661
- }, {
662
- name: 'description',
663
- type: 'text-element',
664
- label: reactIntl.defineMessage({
665
- id: "Y7bs1v",
666
- defaultMessage: [{
667
- "type": 0,
668
- "value": "Description"
669
- }]
670
- })
671
- }, {
672
- name: 'background',
673
- type: 'background-recommendation',
674
- label: reactIntl.defineMessage({
675
- id: "+MPZRu",
676
- defaultMessage: [{
677
- "type": 0,
678
- "value": "Background"
679
- }]
680
- })
681
- }, {
682
- name: 'header',
683
- type: 'header',
684
- label: reactIntl.defineMessage({
685
- id: "rhuDxI",
686
- defaultMessage: [{
687
- "type": 0,
688
- "value": "Header"
689
- }]
690
- }),
691
- theme: {
692
- badge: {
693
- label: {
694
- textStyle: 'badge'
695
- },
696
- boxStyle: 'badge'
697
- }
698
- }
699
- }, {
700
- name: 'footer',
701
- type: 'footer',
702
- label: reactIntl.defineMessage({
703
- id: "g4nybp",
704
- defaultMessage: [{
705
- "type": 0,
706
- "value": "Footer"
707
- }]
708
- }),
709
- theme: {
710
- callToAction: {
711
- label: {
712
- textStyle: 'cta'
713
- },
714
- boxStyle: 'cta'
715
- }
716
- }
717
- }]
718
- }];
719
-
720
- exports.UrbaniaRecommendation = UrbaniaRecommendation$1;
721
- exports.default = definition;