@micromag/screen-urbania-article 0.3.65 → 0.3.68

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 +51 -91
  2. package/lib/index.js +51 -91
  3. package/package.json +14 -14
package/es/index.js CHANGED
@@ -100,7 +100,6 @@ var styles = {"container":"micromag-screen-urbania-article-container","empty":"m
100
100
  var propTypes$1 = {
101
101
  hasArticle: PropTypes.bool,
102
102
  type: PropTypes.oneOf(['article', 'video']),
103
- video: PropTypes$1.videoElement,
104
103
  image: PropTypes$1.visualElement,
105
104
  title: PropTypes$1.headingElement,
106
105
  overTitle: PropTypes$1.headingElement,
@@ -120,7 +119,6 @@ var propTypes$1 = {
120
119
  var defaultProps$1 = {
121
120
  hasArticle: false,
122
121
  type: null,
123
- video: null,
124
122
  image: null,
125
123
  title: null,
126
124
  overTitle: null,
@@ -142,9 +140,8 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
142
140
  var _ref6;
143
141
 
144
142
  var hasArticle = _ref.hasArticle,
145
- type = _ref.type;
146
- _ref.video;
147
- var image = _ref.image,
143
+ type = _ref.type,
144
+ image = _ref.image,
148
145
  title = _ref.title,
149
146
  overTitle = _ref.overTitle,
150
147
  authors = _ref.authors,
@@ -188,9 +185,7 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
188
185
  }, [contentTop, contentHeight, width, height]),
189
186
  _useMemo$minContentHe = _useMemo.minContentHeight,
190
187
  minContentHeight = _useMemo$minContentHe === void 0 ? null : _useMemo$minContentHe,
191
- imageHeight = _useMemo.imageHeight; // const { media: currentVideo = null } = video || {};
192
- // console.log('cv', type, currentVideo, video);
193
-
188
+ imageHeight = _useMemo.imageHeight;
194
189
 
195
190
  var _useScreenRenderConte = useScreenRenderContext(),
196
191
  isView = _useScreenRenderConte.isView,
@@ -221,8 +216,7 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
221
216
  var backgroundShouldLoad = current || active || !isView;
222
217
  var transitionPlaying = current;
223
218
  var transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
224
- var hasCallToAction = callToAction !== null && callToAction.active === true; // console.log('hasCTA', hasCallToAction, isEdit);
225
-
219
+ var hasCallToAction = callToAction !== null && callToAction.active === true;
226
220
  var items = [/*#__PURE__*/React.createElement(ScreenElement, {
227
221
  key: "overTitle",
228
222
  placeholder: /*#__PURE__*/React.createElement(PlaceholderSubtitle, {
@@ -445,8 +439,6 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
445
439
  author = _ref3$author === void 0 ? null : _ref3$author,
446
440
  _ref3$image = _ref3.image,
447
441
  image = _ref3$image === void 0 ? {} : _ref3$image,
448
- _ref3$video = _ref3.video,
449
- video = _ref3$video === void 0 ? {} : _ref3$video,
450
442
  _ref3$callToAction = _ref3.callToAction,
451
443
  callToAction = _ref3$callToAction === void 0 ? null : _ref3$callToAction;
452
444
 
@@ -460,59 +452,55 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
460
452
 
461
453
  var _ref6 = image || {},
462
454
  _ref6$url = _ref6.url,
463
- imageUrl = _ref6$url === void 0 ? null : _ref6$url;
464
-
465
- var _ref7 = video || {},
466
- _ref7$media = _ref7.media,
467
- videoMedia = _ref7$media === void 0 ? null : _ref7$media; // Straight from article
468
-
469
-
470
- var _ref8 = article || {},
471
- _ref8$type = _ref8.type,
472
- type = _ref8$type === void 0 ? null : _ref8$type,
473
- _ref8$title = _ref8.title,
474
- articleTitle = _ref8$title === void 0 ? null : _ref8$title,
475
- _ref8$image = _ref8.image,
476
- articleImage = _ref8$image === void 0 ? null : _ref8$image,
477
- _ref8$metadata = _ref8.metadata,
478
- metadata = _ref8$metadata === void 0 ? {} : _ref8$metadata;
479
-
480
- var _ref9 = metadata || {},
481
- _ref9$authors = _ref9.authors,
482
- authors = _ref9$authors === void 0 ? [] : _ref9$authors,
483
- _ref9$sponsors = _ref9.sponsors,
484
- sponsors = _ref9$sponsors === void 0 ? [] : _ref9$sponsors,
485
- _ref9$site = _ref9.site,
486
- site = _ref9$site === void 0 ? null : _ref9$site,
487
- _ref9$canonical = _ref9.canonical,
488
- canonical = _ref9$canonical === void 0 ? null : _ref9$canonical;
489
-
490
- var _ref10 = articleImage || {},
491
- _ref10$sizes = _ref10.sizes,
492
- sizes = _ref10$sizes === void 0 ? {} : _ref10$sizes;
493
-
494
- var _ref11 = sizes || {},
495
- medium = _ref11.medium,
496
- large = _ref11.large;
497
-
498
- var hasSponsor = isTextFilled(sponsor); // Type
455
+ imageUrl = _ref6$url === void 0 ? null : _ref6$url; // Straight from article
456
+
457
+
458
+ var _ref7 = article || {},
459
+ _ref7$type = _ref7.type,
460
+ type = _ref7$type === void 0 ? null : _ref7$type,
461
+ _ref7$title = _ref7.title,
462
+ articleTitle = _ref7$title === void 0 ? null : _ref7$title,
463
+ _ref7$image = _ref7.image,
464
+ articleImage = _ref7$image === void 0 ? null : _ref7$image,
465
+ _ref7$metadata = _ref7.metadata,
466
+ metadata = _ref7$metadata === void 0 ? {} : _ref7$metadata;
467
+
468
+ var _ref8 = metadata || {},
469
+ _ref8$authors = _ref8.authors,
470
+ authors = _ref8$authors === void 0 ? [] : _ref8$authors,
471
+ _ref8$sponsors = _ref8.sponsors,
472
+ sponsors = _ref8$sponsors === void 0 ? [] : _ref8$sponsors,
473
+ _ref8$site = _ref8.site,
474
+ site = _ref8$site === void 0 ? null : _ref8$site,
475
+ _ref8$canonical = _ref8.canonical,
476
+ canonical = _ref8$canonical === void 0 ? null : _ref8$canonical;
477
+
478
+ var _ref9 = articleImage || {},
479
+ _ref9$sizes = _ref9.sizes,
480
+ sizes = _ref9$sizes === void 0 ? {} : _ref9$sizes;
481
+
482
+ var _ref10 = sizes || {},
483
+ medium = _ref10.medium,
484
+ large = _ref10.large; // Type
485
+
499
486
 
500
487
  var defaultType = articleType || type; // Sponsors
501
488
 
502
- var sponsorPrefix = !hasSponsor ? /*#__PURE__*/React.createElement(FormattedMessage, {
489
+ var defaultSponsor = (sponsors || []).length > 0 ? (sponsors || []).map(function (_ref11) {
490
+ var _ref11$name = _ref11.name,
491
+ name = _ref11$name === void 0 ? null : _ref11$name;
492
+ return name;
493
+ }).filter(function (name) {
494
+ return name !== null;
495
+ }).join(', ').trim() : null;
496
+ var hasSponsor = isTextFilled(sponsor);
497
+ var sponsorPrefix = !hasSponsor && defaultSponsor === null ? /*#__PURE__*/React.createElement(FormattedMessage, {
503
498
  id: "+TPjd4",
504
499
  defaultMessage: [{
505
500
  "type": 0,
506
501
  "value": "Presented by"
507
502
  }]
508
503
  }) : null;
509
- var defaultSponsor = (sponsors || []).length > 0 ? (sponsors || []).map(function (_ref12) {
510
- var _ref12$name = _ref12.name,
511
- name = _ref12$name === void 0 ? null : _ref12$name;
512
- return name;
513
- }).filter(function (name) {
514
- return name !== null;
515
- }).join(', ').trim() : null;
516
504
  return {
517
505
  type: defaultType,
518
506
  title: titleBody !== null ? title : _objectSpread(_objectSpread({}, title), {}, {
@@ -521,12 +509,12 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
521
509
  overTitle: overTitleBody !== null ? overTitle : _objectSpread(_objectSpread({}, overTitle), {}, {
522
510
  body: 'En vedette'
523
511
  }),
524
- authors: authors.map(function (_ref13) {
525
- var _ref13$name = _ref13.name,
526
- name = _ref13$name === void 0 ? null : _ref13$name,
527
- _ref13$url = _ref13.url,
528
- authorUrl = _ref13$url === void 0 ? null : _ref13$url,
529
- otherProps = _objectWithoutProperties(_ref13, _excluded2);
512
+ authors: authors.map(function (_ref12) {
513
+ var _ref12$name = _ref12.name,
514
+ name = _ref12$name === void 0 ? null : _ref12$name,
515
+ _ref12$url = _ref12.url,
516
+ authorUrl = _ref12$url === void 0 ? null : _ref12$url,
517
+ otherProps = _objectWithoutProperties(_ref12, _excluded2);
530
518
 
531
519
  return _objectSpread({
532
520
  name: {
@@ -549,11 +537,10 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
549
537
  large: large
550
538
  }
551
539
  }),
552
- video: _objectSpread({}, video),
553
540
  callToAction: _objectSpread({
554
541
  active: true,
555
542
  type: 'swipe-up',
556
- url: videoMedia !== null ? videoMedia.url : canonical,
543
+ url: canonical,
557
544
  label: defaultType === 'video' ? {
558
545
  body: 'Regarder'
559
546
  } : {
@@ -698,33 +685,6 @@ var definition = {
698
685
  "value": "Image"
699
686
  }]
700
687
  })
701
- }, {
702
- name: 'video',
703
- type: 'video-element',
704
- theme: {
705
- color: 'primary'
706
- },
707
- defaultValue: {
708
- autoPlay: true
709
- },
710
- label: defineMessage({
711
- id: "tvl2Zc",
712
- defaultMessage: [{
713
- "type": 0,
714
- "value": "Video"
715
- }]
716
- })
717
- }, {
718
- name: 'gotoNextScreenOnEnd',
719
- type: 'toggle',
720
- defaultValue: false,
721
- label: defineMessage({
722
- id: "n8zmLY",
723
- defaultMessage: [{
724
- "type": 0,
725
- "value": "Go to next screen on end"
726
- }]
727
- })
728
688
  }, {
729
689
  name: 'background',
730
690
  type: 'background',
package/lib/index.js CHANGED
@@ -120,7 +120,6 @@ var styles = {"container":"micromag-screen-urbania-article-container","empty":"m
120
120
  var propTypes$1 = {
121
121
  hasArticle: PropTypes__default["default"].bool,
122
122
  type: PropTypes__default["default"].oneOf(['article', 'video']),
123
- video: core.PropTypes.videoElement,
124
123
  image: core.PropTypes.visualElement,
125
124
  title: core.PropTypes.headingElement,
126
125
  overTitle: core.PropTypes.headingElement,
@@ -140,7 +139,6 @@ var propTypes$1 = {
140
139
  var defaultProps$1 = {
141
140
  hasArticle: false,
142
141
  type: null,
143
- video: null,
144
142
  image: null,
145
143
  title: null,
146
144
  overTitle: null,
@@ -162,9 +160,8 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
162
160
  var _ref6;
163
161
 
164
162
  var hasArticle = _ref.hasArticle,
165
- type = _ref.type;
166
- _ref.video;
167
- var image = _ref.image,
163
+ type = _ref.type,
164
+ image = _ref.image,
168
165
  title = _ref.title,
169
166
  overTitle = _ref.overTitle,
170
167
  authors = _ref.authors,
@@ -208,9 +205,7 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
208
205
  }, [contentTop, contentHeight, width, height]),
209
206
  _useMemo$minContentHe = _useMemo.minContentHeight,
210
207
  minContentHeight = _useMemo$minContentHe === void 0 ? null : _useMemo$minContentHe,
211
- imageHeight = _useMemo.imageHeight; // const { media: currentVideo = null } = video || {};
212
- // console.log('cv', type, currentVideo, video);
213
-
208
+ imageHeight = _useMemo.imageHeight;
214
209
 
215
210
  var _useScreenRenderConte = contexts.useScreenRenderContext(),
216
211
  isView = _useScreenRenderConte.isView,
@@ -241,8 +236,7 @@ var UrbaniaArticle = function UrbaniaArticle(_ref) {
241
236
  var backgroundShouldLoad = current || active || !isView;
242
237
  var transitionPlaying = current;
243
238
  var transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
244
- var hasCallToAction = callToAction !== null && callToAction.active === true; // console.log('hasCTA', hasCallToAction, isEdit);
245
-
239
+ var hasCallToAction = callToAction !== null && callToAction.active === true;
246
240
  var items = [/*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
247
241
  key: "overTitle",
248
242
  placeholder: /*#__PURE__*/React__default["default"].createElement(components.PlaceholderSubtitle, {
@@ -465,8 +459,6 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
465
459
  author = _ref3$author === void 0 ? null : _ref3$author,
466
460
  _ref3$image = _ref3.image,
467
461
  image = _ref3$image === void 0 ? {} : _ref3$image,
468
- _ref3$video = _ref3.video,
469
- video = _ref3$video === void 0 ? {} : _ref3$video,
470
462
  _ref3$callToAction = _ref3.callToAction,
471
463
  callToAction = _ref3$callToAction === void 0 ? null : _ref3$callToAction;
472
464
 
@@ -480,59 +472,55 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
480
472
 
481
473
  var _ref6 = image || {},
482
474
  _ref6$url = _ref6.url,
483
- imageUrl = _ref6$url === void 0 ? null : _ref6$url;
484
-
485
- var _ref7 = video || {},
486
- _ref7$media = _ref7.media,
487
- videoMedia = _ref7$media === void 0 ? null : _ref7$media; // Straight from article
488
-
489
-
490
- var _ref8 = article || {},
491
- _ref8$type = _ref8.type,
492
- type = _ref8$type === void 0 ? null : _ref8$type,
493
- _ref8$title = _ref8.title,
494
- articleTitle = _ref8$title === void 0 ? null : _ref8$title,
495
- _ref8$image = _ref8.image,
496
- articleImage = _ref8$image === void 0 ? null : _ref8$image,
497
- _ref8$metadata = _ref8.metadata,
498
- metadata = _ref8$metadata === void 0 ? {} : _ref8$metadata;
499
-
500
- var _ref9 = metadata || {},
501
- _ref9$authors = _ref9.authors,
502
- authors = _ref9$authors === void 0 ? [] : _ref9$authors,
503
- _ref9$sponsors = _ref9.sponsors,
504
- sponsors = _ref9$sponsors === void 0 ? [] : _ref9$sponsors,
505
- _ref9$site = _ref9.site,
506
- site = _ref9$site === void 0 ? null : _ref9$site,
507
- _ref9$canonical = _ref9.canonical,
508
- canonical = _ref9$canonical === void 0 ? null : _ref9$canonical;
509
-
510
- var _ref10 = articleImage || {},
511
- _ref10$sizes = _ref10.sizes,
512
- sizes = _ref10$sizes === void 0 ? {} : _ref10$sizes;
513
-
514
- var _ref11 = sizes || {},
515
- medium = _ref11.medium,
516
- large = _ref11.large;
517
-
518
- var hasSponsor = utils.isTextFilled(sponsor); // Type
475
+ imageUrl = _ref6$url === void 0 ? null : _ref6$url; // Straight from article
476
+
477
+
478
+ var _ref7 = article || {},
479
+ _ref7$type = _ref7.type,
480
+ type = _ref7$type === void 0 ? null : _ref7$type,
481
+ _ref7$title = _ref7.title,
482
+ articleTitle = _ref7$title === void 0 ? null : _ref7$title,
483
+ _ref7$image = _ref7.image,
484
+ articleImage = _ref7$image === void 0 ? null : _ref7$image,
485
+ _ref7$metadata = _ref7.metadata,
486
+ metadata = _ref7$metadata === void 0 ? {} : _ref7$metadata;
487
+
488
+ var _ref8 = metadata || {},
489
+ _ref8$authors = _ref8.authors,
490
+ authors = _ref8$authors === void 0 ? [] : _ref8$authors,
491
+ _ref8$sponsors = _ref8.sponsors,
492
+ sponsors = _ref8$sponsors === void 0 ? [] : _ref8$sponsors,
493
+ _ref8$site = _ref8.site,
494
+ site = _ref8$site === void 0 ? null : _ref8$site,
495
+ _ref8$canonical = _ref8.canonical,
496
+ canonical = _ref8$canonical === void 0 ? null : _ref8$canonical;
497
+
498
+ var _ref9 = articleImage || {},
499
+ _ref9$sizes = _ref9.sizes,
500
+ sizes = _ref9$sizes === void 0 ? {} : _ref9$sizes;
501
+
502
+ var _ref10 = sizes || {},
503
+ medium = _ref10.medium,
504
+ large = _ref10.large; // Type
505
+
519
506
 
520
507
  var defaultType = articleType || type; // Sponsors
521
508
 
522
- var sponsorPrefix = !hasSponsor ? /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
509
+ var defaultSponsor = (sponsors || []).length > 0 ? (sponsors || []).map(function (_ref11) {
510
+ var _ref11$name = _ref11.name,
511
+ name = _ref11$name === void 0 ? null : _ref11$name;
512
+ return name;
513
+ }).filter(function (name) {
514
+ return name !== null;
515
+ }).join(', ').trim() : null;
516
+ var hasSponsor = utils.isTextFilled(sponsor);
517
+ var sponsorPrefix = !hasSponsor && defaultSponsor === null ? /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
523
518
  id: "+TPjd4",
524
519
  defaultMessage: [{
525
520
  "type": 0,
526
521
  "value": "Presented by"
527
522
  }]
528
523
  }) : null;
529
- var defaultSponsor = (sponsors || []).length > 0 ? (sponsors || []).map(function (_ref12) {
530
- var _ref12$name = _ref12.name,
531
- name = _ref12$name === void 0 ? null : _ref12$name;
532
- return name;
533
- }).filter(function (name) {
534
- return name !== null;
535
- }).join(', ').trim() : null;
536
524
  return {
537
525
  type: defaultType,
538
526
  title: titleBody !== null ? title : _objectSpread__default["default"](_objectSpread__default["default"]({}, title), {}, {
@@ -541,12 +529,12 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
541
529
  overTitle: overTitleBody !== null ? overTitle : _objectSpread__default["default"](_objectSpread__default["default"]({}, overTitle), {}, {
542
530
  body: 'En vedette'
543
531
  }),
544
- authors: authors.map(function (_ref13) {
545
- var _ref13$name = _ref13.name,
546
- name = _ref13$name === void 0 ? null : _ref13$name,
547
- _ref13$url = _ref13.url,
548
- authorUrl = _ref13$url === void 0 ? null : _ref13$url,
549
- otherProps = _objectWithoutProperties__default["default"](_ref13, _excluded2);
532
+ authors: authors.map(function (_ref12) {
533
+ var _ref12$name = _ref12.name,
534
+ name = _ref12$name === void 0 ? null : _ref12$name,
535
+ _ref12$url = _ref12.url,
536
+ authorUrl = _ref12$url === void 0 ? null : _ref12$url,
537
+ otherProps = _objectWithoutProperties__default["default"](_ref12, _excluded2);
550
538
 
551
539
  return _objectSpread__default["default"]({
552
540
  name: {
@@ -569,11 +557,10 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
569
557
  large: large
570
558
  }
571
559
  }),
572
- video: _objectSpread__default["default"]({}, video),
573
560
  callToAction: _objectSpread__default["default"]({
574
561
  active: true,
575
562
  type: 'swipe-up',
576
- url: videoMedia !== null ? videoMedia.url : canonical,
563
+ url: canonical,
577
564
  label: defaultType === 'video' ? {
578
565
  body: 'Regarder'
579
566
  } : {
@@ -718,33 +705,6 @@ var definition = {
718
705
  "value": "Image"
719
706
  }]
720
707
  })
721
- }, {
722
- name: 'video',
723
- type: 'video-element',
724
- theme: {
725
- color: 'primary'
726
- },
727
- defaultValue: {
728
- autoPlay: true
729
- },
730
- label: reactIntl.defineMessage({
731
- id: "tvl2Zc",
732
- defaultMessage: [{
733
- "type": 0,
734
- "value": "Video"
735
- }]
736
- })
737
- }, {
738
- name: 'gotoNextScreenOnEnd',
739
- type: 'toggle',
740
- defaultValue: false,
741
- label: reactIntl.defineMessage({
742
- id: "n8zmLY",
743
- defaultMessage: [{
744
- "type": 0,
745
- "value": "Go to next screen on end"
746
- }]
747
- })
748
708
  }, {
749
709
  name: 'background',
750
710
  type: 'background',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-urbania-article",
3
- "version": "0.3.65",
3
+ "version": "0.3.68",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -51,18 +51,18 @@
51
51
  "@babel/runtime": "^7.13.10",
52
52
  "@folklore/fetch": "^0.1.15",
53
53
  "@folklore/size": "^0.1.20",
54
- "@micromag/core": "^0.3.64",
55
- "@micromag/element-background": "^0.3.64",
56
- "@micromag/element-call-to-action": "^0.3.65",
57
- "@micromag/element-closed-captions": "^0.3.64",
58
- "@micromag/element-container": "^0.3.64",
59
- "@micromag/element-heading": "^0.3.64",
60
- "@micromag/element-image": "^0.3.64",
61
- "@micromag/element-media-controls": "^0.3.64",
62
- "@micromag/element-urbania-author": "^0.3.64",
63
- "@micromag/element-video": "^0.3.64",
64
- "@micromag/element-visual": "^0.3.64",
65
- "@micromag/transforms": "^0.3.64",
54
+ "@micromag/core": "^0.3.68",
55
+ "@micromag/element-background": "^0.3.68",
56
+ "@micromag/element-call-to-action": "^0.3.68",
57
+ "@micromag/element-closed-captions": "^0.3.68",
58
+ "@micromag/element-container": "^0.3.68",
59
+ "@micromag/element-heading": "^0.3.68",
60
+ "@micromag/element-image": "^0.3.68",
61
+ "@micromag/element-media-controls": "^0.3.68",
62
+ "@micromag/element-urbania-author": "^0.3.68",
63
+ "@micromag/element-video": "^0.3.68",
64
+ "@micromag/element-visual": "^0.3.68",
65
+ "@micromag/transforms": "^0.3.68",
66
66
  "classnames": "^2.2.6",
67
67
  "lodash": "^4.17.21",
68
68
  "prop-types": "^15.7.2",
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "aa150c0fbb32c481b04e4c98863b7656db714845"
75
+ "gitHead": "3f6e61d8a3340735f345a20d1f0f86e91c820d9a"
76
76
  }