@liquidcommercedev/rmn-sdk 1.5.0-beta.42 → 1.5.0-beta.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -18413,11 +18413,11 @@ class RbHomepageHeroThreeTileSE extends BaseSpotComponent {
18413
18413
  }
18414
18414
 
18415
18415
  @container (max-width: 767px) {
18416
- .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.LEFT} .${prefix}__main {
18416
+ .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.RIGHT} .${prefix}__main {
18417
18417
  flex-direction: row;
18418
18418
  }
18419
18419
 
18420
- .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.RIGHT} .${prefix}__main {
18420
+ .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.LEFT} .${prefix}__main {
18421
18421
  flex-direction: row-reverse;
18422
18422
  }
18423
18423
  }
@@ -19787,6 +19787,7 @@ class RbSmallDiscoverToutSE extends BaseSpotComponent {
19787
19787
  class RbVideoPlayerSE extends BaseSpotComponent {
19788
19788
  constructor() {
19789
19789
  super();
19790
+ this.reRenderOnDeviceChange = true;
19790
19791
  this.videoSelector = () => `.${this._config.prefix}__video-element`;
19791
19792
  this.muteButtonSelector = () => `.${this._config.prefix}__mute-button`;
19792
19793
  this.video = null;
@@ -19852,54 +19853,98 @@ class RbVideoPlayerSE extends BaseSpotComponent {
19852
19853
  const muteButton = this._container.querySelector(this.muteButtonSelector());
19853
19854
  muteButton === null || muteButton === undefined ? undefined : muteButton.removeEventListener('click', this.handleMuteToggle);
19854
19855
  }
19856
+ getGradientDirection(position) {
19857
+ switch (position) {
19858
+ case exports.ENUM_TEXT_BLOCK_POSITION.TOP_LEFT:
19859
+ case exports.ENUM_TEXT_BLOCK_POSITION.TOP_RIGHT:
19860
+ return 'to bottom';
19861
+ case exports.ENUM_TEXT_BLOCK_POSITION.MIDDLE_LEFT:
19862
+ return 'to right';
19863
+ case exports.ENUM_TEXT_BLOCK_POSITION.MIDDLE_RIGHT:
19864
+ return 'to left';
19865
+ case exports.ENUM_TEXT_BLOCK_POSITION.BOTTOM_LEFT:
19866
+ case exports.ENUM_TEXT_BLOCK_POSITION.BOTTOM_RIGHT:
19867
+ return 'to top';
19868
+ default:
19869
+ return 'to top';
19870
+ }
19871
+ }
19872
+ get hasContent() {
19873
+ const { header, mobileHeader, description, mobileDescription,
19874
+ // eslint-disable-next-line @typescript-eslint/naming-convention
19875
+ enableMobileTexts = false, } = this._data;
19876
+ const content = this._isMobileDevice && enableMobileTexts
19877
+ ? {
19878
+ header: mobileHeader,
19879
+ description: mobileDescription,
19880
+ }
19881
+ : { header, description };
19882
+ return Object.values(content).some(Boolean);
19883
+ }
19855
19884
  template() {
19856
19885
  const prefix = this._config.prefix;
19857
- const { url, posterTitle, posterDescription } = this._data.video;
19886
+ const { header, mobileHeader, description, mobileDescription, textBlockPosition = exports.ENUM_TEXT_BLOCK_POSITION.BOTTOM_LEFT, mobileTextBlockPosition = textBlockPosition,
19887
+ // eslint-disable-next-line @typescript-eslint/naming-convention
19888
+ enableMobileTexts = false, } = this._data;
19889
+ // eslint-disable-next-line @typescript-eslint/naming-convention
19890
+ const { url, mobileUrl = url, mute = true, showMute = true } = this._data.video;
19858
19891
  if (!url) {
19859
19892
  return '<p>Please provide a video source</p>';
19860
19893
  }
19861
19894
  const renderOverlay = () => {
19862
- if (!posterTitle && !posterDescription)
19895
+ if (!this.hasContent)
19863
19896
  return '';
19897
+ const content = this._isMobileDevice && enableMobileTexts
19898
+ ? {
19899
+ header: mobileHeader,
19900
+ description: mobileDescription,
19901
+ }
19902
+ : { header, description };
19903
+ const elements = [
19904
+ renderElement('h2', `${prefix}__header`, content.header),
19905
+ renderElement('p', `${prefix}__description`, content.description),
19906
+ ];
19864
19907
  return `
19865
- <div class="${prefix}__overlay">
19866
- <div class="${prefix}__overlay-text">
19867
- ${posterTitle ? `<h2 class="${prefix}__title">${posterTitle}</h2>` : ''}
19868
- ${posterDescription ? `<p class="${prefix}__description">${posterDescription}</p>` : ''}
19869
- </div>
19908
+ <div class="${prefix}__text ${prefix}__text-block--${textBlockPosition} ${prefix}__text-block-mobile--${mobileTextBlockPosition}">
19909
+ ${elements.join('')}
19870
19910
  </div>
19871
19911
  `;
19872
19912
  };
19873
19913
  const renderVideo = () => `
19874
- <div class="${prefix}__video-container">
19875
- <video
19876
- class="${prefix}__video-element"
19877
- src="${url}"
19878
- autoplay
19879
- muted
19880
- loop
19881
- preload="metadata"
19882
- >
19883
- Your browser doesn't support HTML5 video playback.
19884
- </video>
19885
- </div>
19886
- `;
19887
- const renderMuteButton = () => `
19888
- <button type="button" class="${prefix}__mute-button">
19889
- <span class="${prefix}__mute-icon">
19890
- ${this.getMuteIcon()}
19891
- </span>
19892
- </button>
19893
- `;
19894
- const renderControls = () => `
19895
- <div class="${prefix}__controls">
19896
- ${renderMuteButton()}
19914
+ <div class="${prefix}__video-wrapper">
19915
+ <div class="${prefix}__video-container">
19916
+ <video
19917
+ class="${prefix}__video-element"
19918
+ src="${this._isMobileDevice ? mobileUrl : url}"
19919
+ autoplay
19920
+ ${mute ? 'muted' : ''}
19921
+ loop
19922
+ preload="metadata"
19923
+ playsinline
19924
+ >
19925
+ Your browser doesn't support HTML5 video playback.
19926
+ </video>
19927
+ </div>
19897
19928
  </div>
19898
19929
  `;
19930
+ const renderMuteButton = () => showMute
19931
+ ? `
19932
+ <button type="button" class="${prefix}__mute-button">
19933
+ <span class="${prefix}__mute-icon">
19934
+ ${this.getMuteIcon()}
19935
+ </span>
19936
+ </button>
19937
+ `
19938
+ : '';
19939
+ const renderControls = () => showMute
19940
+ ? `
19941
+ <div class="${prefix}__controls">
19942
+ ${renderMuteButton()}
19943
+ </div>
19944
+ `
19945
+ : '';
19899
19946
  return `
19900
- ${GFONT_PRECONNECT}
19901
- ${GFONT_SOURCE_SANS_3}
19902
- ${GFONT_CORMORANT}
19947
+ ${importFonts()}
19903
19948
  <div class="${prefix}">
19904
19949
  ${renderOverlay()}
19905
19950
  ${renderVideo()}
@@ -19909,67 +19954,217 @@ class RbVideoPlayerSE extends BaseSpotComponent {
19909
19954
  }
19910
19955
  styles() {
19911
19956
  const prefix = this._config.prefix;
19957
+ const { width, height, textBlockPosition = exports.ENUM_TEXT_BLOCK_POSITION.BOTTOM_LEFT, mobileTextBlockPosition = textBlockPosition, textColor = '#ffffff', } = this._data;
19958
+ const { aspectRatio = '16:9' } = this._data.video;
19959
+ const desktopGradientDirection = this.getGradientDirection(textBlockPosition);
19960
+ const mobileGradientDirection = this.getGradientDirection(mobileTextBlockPosition);
19961
+ const linearGradient = generateGradientColor(this._config.overlay, 'rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 40%');
19962
+ const hostSelector = this._config.useShadowDom ? ':host' : this.tagName.toLowerCase();
19912
19963
  return `
19964
+ ${hostSelector} {
19965
+ width: 100%;
19966
+ height: 100%;
19967
+ max-width: ${width}px;
19968
+ max-height: ${height}px};
19969
+ }
19970
+
19913
19971
  .${prefix} {
19914
19972
  width: 100%;
19915
19973
  height: 100%;
19916
- background: #000;
19974
+ background: #fff;
19917
19975
  overflow: hidden;
19918
19976
  position: relative;
19919
19977
  }
19920
19978
 
19921
- .${prefix}__overlay {
19979
+ .${prefix}::before {
19980
+ content: '';
19922
19981
  position: absolute;
19923
19982
  top: 0;
19924
19983
  left: 0;
19925
19984
  right: 0;
19926
- z-index: 2;
19985
+ bottom: 0;
19986
+ z-index: 1;
19987
+ pointer-events: none;
19988
+ }
19989
+
19990
+ .${prefix}__video-wrapper {
19991
+ width: 100%;
19992
+ height: 100%;
19993
+ position: relative;
19994
+ overflow: hidden;
19995
+ }
19996
+
19997
+ .${prefix}__video-container {
19998
+ position: relative;
19927
19999
  width: 100%;
19928
20000
  height: 100%;
19929
20001
  display: flex;
19930
- flex-direction: column;
19931
- justify-content: flex-end;
19932
- background-image: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 40%);
20002
+ justify-content: center;
20003
+ align-items: center;
20004
+ aspect-ratio: ${aspectRatio.replace(':', '/')};
19933
20005
  }
19934
20006
 
19935
- .${prefix}__overlay-text {
19936
- padding: 3rem;
20007
+ .${prefix}__video-element {
20008
+ position: absolute;
20009
+ top: 50%;
20010
+ left: 50%;
20011
+ transform: translate(-50%, -50%);
20012
+ width: 100%;
20013
+ height: 100%;
20014
+ object-fit: contain;
20015
+ }
20016
+
20017
+ @media (max-aspect-ratio: 16/9) {
20018
+ .${prefix}__video-element {
20019
+ width: 100%;
20020
+ height: auto;
20021
+ }
20022
+ }
20023
+
20024
+ @media (min-aspect-ratio: 16/9) {
20025
+ .${prefix}__video-element {
20026
+ width: auto;
20027
+ height: 100%;
20028
+ }
20029
+ }
20030
+
20031
+ .${prefix}__text {
19937
20032
  display: flex;
19938
20033
  flex-direction: column;
20034
+ justify-content: flex-start;
20035
+ align-items: flex-start;
20036
+ width: 100%;
20037
+ height: fit-content;
19939
20038
  gap: 8px;
20039
+ position: absolute;
20040
+ color: ${textColor};
20041
+ z-index: 10;
19940
20042
  }
19941
20043
 
19942
- .${prefix}__title {
19943
- color: #fff;
19944
- font-size: 26px;
19945
- margin: 0;
19946
- font-family: "Cormorant", system-ui;
19947
- font-style: normal;
19948
- font-weight: 300;
19949
- line-height: normal;
20044
+ @container (max-width: 639px) {
20045
+ .${prefix}::before {
20046
+ ${this.hasContent
20047
+ ? `background: linear-gradient(${mobileGradientDirection}, ${linearGradient});`
20048
+ : ``}
20049
+ }
20050
+
20051
+ .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.TOP_LEFT} {
20052
+ top: 3%;
20053
+ left: 3%;
20054
+ align-items: flex-start;
20055
+ text-align: left;
20056
+ }
20057
+
20058
+ .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.TOP_RIGHT} {
20059
+ top: 3%;
20060
+ right: 3%;
20061
+ align-items: flex-end;
20062
+ text-align: right;
20063
+ }
20064
+
20065
+ .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.MIDDLE_LEFT} {
20066
+ top: 50%;
20067
+ left: 3%;
20068
+ transform: translateY(-50%);
20069
+ align-items: flex-start;
20070
+ text-align: left;
20071
+ }
20072
+
20073
+ .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.MIDDLE_RIGHT} {
20074
+ top: 50%;
20075
+ right: 3%;
20076
+ transform: translateY(-50%);
20077
+ align-items: flex-end;
20078
+ text-align: right;
20079
+ }
20080
+
20081
+ .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.BOTTOM_LEFT} {
20082
+ bottom: 3%;
20083
+ left: 3%;
20084
+ align-items: flex-start;
20085
+ text-align: left;
20086
+ }
20087
+
20088
+ .${prefix}__text-block-mobile--${exports.ENUM_TEXT_BLOCK_POSITION.BOTTOM_RIGHT} {
20089
+ bottom: 3%;
20090
+ right: 3%;
20091
+ align-items: flex-end;
20092
+ text-align: right;
20093
+ }
19950
20094
  }
19951
20095
 
19952
- .${prefix}__description {
19953
- color: #ccc;
19954
- margin: 0;
19955
- font-size: 13px;
19956
- font-family: "Source Sans 3", system-ui;
19957
- font-style: normal;
19958
- font-weight: 400;
19959
- line-height: 20px;
20096
+ @container (min-width: 640px) {
20097
+ .${prefix}::before {
20098
+ ${this.hasContent
20099
+ ? `background: linear-gradient(${desktopGradientDirection}, ${linearGradient});`
20100
+ : ``}
20101
+ }
20102
+
20103
+ .${prefix}__text {
20104
+ width: 70%;
20105
+ }
20106
+
20107
+ .${prefix}__text-block--${exports.ENUM_TEXT_BLOCK_POSITION.TOP_LEFT} {
20108
+ top: 3%;
20109
+ left: 3%;
20110
+ align-items: flex-start;
20111
+ text-align: left;
20112
+ }
20113
+
20114
+ .${prefix}__text-block--${exports.ENUM_TEXT_BLOCK_POSITION.TOP_RIGHT} {
20115
+ top: 3%;
20116
+ right: 3%;
20117
+ align-items: flex-end;
20118
+ text-align: right;
20119
+ }
20120
+
20121
+ .${prefix}__text-block--${exports.ENUM_TEXT_BLOCK_POSITION.MIDDLE_LEFT} {
20122
+ top: 50%;
20123
+ left: 3%;
20124
+ transform: translateY(-50%);
20125
+ align-items: flex-start;
20126
+ text-align: left;
20127
+ }
20128
+
20129
+ .${prefix}__text-block--${exports.ENUM_TEXT_BLOCK_POSITION.MIDDLE_RIGHT} {
20130
+ top: 50%;
20131
+ right: 3%;
20132
+ transform: translateY(-50%);
20133
+ align-items: flex-end;
20134
+ text-align: right;
20135
+ }
20136
+
20137
+ .${prefix}__text-block--${exports.ENUM_TEXT_BLOCK_POSITION.BOTTOM_LEFT} {
20138
+ bottom: 3%;
20139
+ left: 3%;
20140
+ align-items: flex-start;
20141
+ text-align: left;
20142
+ }
20143
+
20144
+ .${prefix}__text-block--${exports.ENUM_TEXT_BLOCK_POSITION.BOTTOM_RIGHT} {
20145
+ bottom: 3%;
20146
+ right: 3%;
20147
+ align-items: flex-end;
20148
+ text-align: right;
20149
+ }
19960
20150
  }
19961
20151
 
19962
- .${prefix}__video-container {
19963
- position: relative;
19964
- width: 100%;
19965
- height: 100%;
20152
+ .${prefix}__header {
20153
+ font-size: 24px;
20154
+ margin: 0;
20155
+ font-family: "Cormorant", system-ui;
20156
+ font-style: normal;
20157
+ font-weight: 300;
20158
+ line-height: normal;
19966
20159
  }
19967
20160
 
19968
- .${prefix}__video-element {
19969
- width: 100%;
19970
- height: 100%;
19971
- object-fit: cover;
19972
- display: block;
20161
+ .${prefix}__description {
20162
+ font-size: 10px;
20163
+ font-family: "Source Sans 3", system-ui;
20164
+ font-style: normal;
20165
+ font-weight: 400;
20166
+ line-height: 20px;
20167
+ margin: 0;
19973
20168
  }
19974
20169
 
19975
20170
  .${prefix}__controls {
@@ -19982,7 +20177,7 @@ class RbVideoPlayerSE extends BaseSpotComponent {
19982
20177
  align-items: center;
19983
20178
  opacity: 0;
19984
20179
  transition: opacity 0.3s;
19985
- z-index: 3;
20180
+ z-index: 100;
19986
20181
  width: fit-content;
19987
20182
  border-radius: 50%;
19988
20183
  }
@@ -19991,7 +20186,7 @@ class RbVideoPlayerSE extends BaseSpotComponent {
19991
20186
  opacity: 1;
19992
20187
  }
19993
20188
 
19994
- .${prefix}__mute-button {
20189
+ .${prefix}__mute-button {
19995
20190
  background: none;
19996
20191
  border: none;
19997
20192
  color: white;
@@ -20012,6 +20207,38 @@ class RbVideoPlayerSE extends BaseSpotComponent {
20012
20207
  .${prefix}__mute-button:hover {
20013
20208
  opacity: 0.8;
20014
20209
  }
20210
+
20211
+ @container (min-width: 640px) {
20212
+ .${prefix}__text {
20213
+ width: 70%;
20214
+ }
20215
+ }
20216
+
20217
+ @container (min-width: 768px) {
20218
+ .${prefix}__description {
20219
+ font-size: 12px;
20220
+ }
20221
+ }
20222
+
20223
+ @container (min-width: 1024px) {
20224
+ .${prefix}__header {
20225
+ font-size: 26px;
20226
+ }
20227
+
20228
+ .${prefix}__description {
20229
+ font-size: 13px;
20230
+ }
20231
+ }
20232
+
20233
+ @container (min-width: 1280px) {
20234
+ .${prefix}__header {
20235
+ font-size: 28px;
20236
+ }
20237
+
20238
+ .${prefix}__description {
20239
+ font-size: 14px;
20240
+ }
20241
+ }
20015
20242
  `;
20016
20243
  }
20017
20244
  }