pageflow 15.2.2 → 15.6.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pageflow might be problematic. Click here for more details.

Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -118
  3. data/README.md +2 -3
  4. data/admins/pageflow/accounts.rb +1 -98
  5. data/admins/pageflow/entry.rb +21 -1
  6. data/admins/pageflow/entry_templates.rb +140 -0
  7. data/admins/pageflow/membership.rb +12 -0
  8. data/admins/pageflow/user.rb +5 -5
  9. data/app/assets/javascripts/pageflow/admin/entries.js +65 -0
  10. data/app/assets/javascripts/pageflow/admin/users.js +1 -1
  11. data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -0
  12. data/app/assets/javascripts/pageflow/base.js +0 -12
  13. data/app/assets/javascripts/pageflow/components.js +2 -6
  14. data/app/assets/javascripts/pageflow/dist/ui.js +178 -55
  15. data/app/assets/javascripts/pageflow/editor/vendor.js +1 -0
  16. data/app/assets/javascripts/pageflow/vendor.js +12 -10
  17. data/app/assets/stylesheets/pageflow/base.scss +0 -7
  18. data/app/assets/stylesheets/pageflow/editor/base.scss +5 -2
  19. data/app/assets/stylesheets/pageflow/editor/composables.scss +5 -1
  20. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +1 -1
  21. data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +44 -55
  22. data/app/assets/stylesheets/pageflow/editor/help.scss +2 -2
  23. data/app/assets/stylesheets/pageflow/editor/select_button.scss +1 -1
  24. data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -1
  25. data/app/assets/stylesheets/pageflow/entries.scss +1 -1
  26. data/app/assets/stylesheets/pageflow/loading_spinner.scss +4 -1
  27. data/app/assets/stylesheets/pageflow/navigation_mobile.scss +4 -4
  28. data/app/assets/stylesheets/pageflow/themes/default/anchors.scss +1 -1
  29. data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +1 -1
  30. data/app/assets/stylesheets/pageflow/themes/default/page.scss +7 -0
  31. data/app/assets/stylesheets/pageflow/themes/default/page/anchors.scss +1 -1
  32. data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/control_bar.scss +1 -1
  33. data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/info_box.scss +1 -1
  34. data/app/assets/stylesheets/pageflow/themes/default/player_controls/shared/menu_bar.scss +2 -2
  35. data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/control_bar.scss +2 -2
  36. data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/info_box.scss +1 -1
  37. data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/quality_menu.scss +2 -2
  38. data/app/assets/stylesheets/pageflow/themes/default/player_controls/waveform/wave.scss +1 -1
  39. data/app/assets/stylesheets/pageflow/ui/forms.scss +9 -2
  40. data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +2 -2
  41. data/app/assets/stylesheets/pageflow/ui/tooltip.scss +17 -3
  42. data/app/helpers/pageflow/admin/entries_helper.rb +16 -0
  43. data/app/helpers/pageflow/structured_data_helper.rb +0 -2
  44. data/app/models/pageflow/account.rb +21 -1
  45. data/app/models/pageflow/account_role_query.rb +1 -1
  46. data/app/models/pageflow/chapter.rb +3 -9
  47. data/app/models/pageflow/entry.rb +9 -2
  48. data/app/models/pageflow/entry_duplicate.rb +1 -0
  49. data/app/models/pageflow/entry_template.rb +16 -2
  50. data/app/models/pageflow/managed_user_query.rb +1 -1
  51. data/app/models/pageflow/page.rb +1 -4
  52. data/app/models/pageflow/revision.rb +0 -4
  53. data/app/models/pageflow/storyline.rb +2 -9
  54. data/app/policies/pageflow/account_policy.rb +10 -0
  55. data/app/policies/pageflow/entry_template_policy.rb +5 -1
  56. data/app/policies/pageflow/folder_policy.rb +2 -2
  57. data/app/policies/pageflow/membership_policy.rb +2 -2
  58. data/app/policies/pageflow/theming_policy.rb +2 -2
  59. data/app/policies/pageflow/user_policy.rb +1 -1
  60. data/app/views/admin/accounts/_entry_template_details.html.arb +7 -5
  61. data/app/views/admin/accounts/_form.html.erb +3 -49
  62. data/app/views/admin/entries/_attributes_table.html.arb +5 -0
  63. data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +2 -0
  64. data/app/views/admin/entries/entry_types.json.jbuilder +4 -0
  65. data/app/views/admin/entry_templates/_form.html.erb +58 -0
  66. data/app/views/admin/users/_not_allowed_to_see_user_quota.html.erb +3 -0
  67. data/app/views/components/pageflow/admin/entry_templates_tab.rb +48 -0
  68. data/app/views/pageflow/admin/initial_passwords/edit.html.erb +2 -1
  69. data/app/views/pageflow/admin/users/_quota_exhausted.html.erb +1 -1
  70. data/app/views/pageflow/themes/_theme.json.jbuilder +1 -1
  71. data/app/views/pageflow/video_files/_video_file.json.jbuilder +8 -1
  72. data/config/initializers/admin_resource_tabs.rb +5 -0
  73. data/config/initializers/help_entries.rb +1 -5
  74. data/config/initializers/revision_components.rb +5 -0
  75. data/config/locales/de.yml +88 -155
  76. data/config/locales/en.yml +79 -143
  77. data/db/migrate/20200515112500_add_constraints_to_entry_templates.rb +21 -0
  78. data/db/migrate/20200807135200_rename_pageflow_entry_template_entry_type_to_entry_type_name.rb +7 -0
  79. data/entry_types/paged/app/assets/javascripts/pageflow_paged/components.js +7 -0
  80. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +1528 -1349
  81. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +9258 -0
  82. data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-client.js +1 -1
  83. data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-server.js +3 -3
  84. data/entry_types/paged/app/assets/javascripts/pageflow_paged/frontend.js +6 -0
  85. data/entry_types/paged/app/assets/javascripts/pageflow_paged/server_rendering.js +9 -0
  86. data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +9 -0
  87. data/entry_types/paged/app/assets/javascripts/pageflow_paged/videojs.js +6 -0
  88. data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +2 -2
  89. data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/page_background_asset_helper.rb +4 -3
  90. data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/react_server_side_rendering_helper.rb +23 -2
  91. data/entry_types/paged/app/views/layouts/pageflow_paged/_loading_spinner_inline_script.html.erb +1 -0
  92. data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +3 -3
  93. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +4 -2
  94. data/entry_types/paged/app/views/pageflow_paged/entries/_entry.html.erb +1 -1
  95. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/page_background_asset/_element.html.erb +0 -0
  96. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/_widget.html.erb +0 -0
  97. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/page.html.erb +0 -0
  98. data/entry_types/paged/config/initializers/features.rb +1 -1
  99. data/entry_types/paged/config/initializers/help_entries.rb +17 -0
  100. data/entry_types/paged/config/locales/new/help.de.yml +162 -0
  101. data/entry_types/paged/config/locales/new/help.en.yml +153 -0
  102. data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -0
  103. data/entry_types/paged/lib/pageflow_paged/plugin.rb +5 -1
  104. data/entry_types/paged/lib/pageflow_paged/react.rb +12 -0
  105. data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/page_type.rb +2 -2
  106. data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/widget_type.rb +2 -2
  107. data/entry_types/paged/lib/tasks/pageflow_paged_tasks.rake +7 -0
  108. data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react-server.js +20613 -0
  109. data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react.js +21495 -0
  110. data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/dash.all.min.js +0 -0
  111. data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs-dash.js +0 -0
  112. data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs.js +0 -0
  113. data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react-server.js +24 -0
  114. data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react.js +24 -0
  115. data/entry_types/scrolled/app/assets/javascripts/pageflow_scrolled/legacy.js +0 -0
  116. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
  117. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +14 -4
  118. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
  119. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +10 -0
  120. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +7 -0
  121. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +2 -0
  122. data/entry_types/scrolled/app/helpers/pageflow_scrolled/favicon_helper.rb +21 -0
  123. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +40 -0
  124. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +36 -0
  125. data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +3 -9
  126. data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +37 -2
  127. data/entry_types/scrolled/app/models/pageflow_scrolled/section.rb +3 -9
  128. data/entry_types/scrolled/app/models/pageflow_scrolled/storyline.rb +1 -9
  129. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/content_elements/batch.json.jbuilder +2 -0
  130. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -7
  131. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/_global_notices.html.erb +10 -0
  132. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +28 -11
  133. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +3 -0
  134. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +8 -0
  135. data/entry_types/scrolled/app/views/pageflow_scrolled/favicons/_entry.html.erb +10 -0
  136. data/entry_types/scrolled/config/initializers/help_entries.rb +16 -0
  137. data/entry_types/scrolled/config/locales/de.yml +669 -0
  138. data/entry_types/scrolled/config/locales/en.yml +488 -0
  139. data/entry_types/scrolled/config/routes.rb +1 -0
  140. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +76 -6
  141. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-192x192.png +0 -0
  142. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-512x512.png +0 -0
  143. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/apple-touch-icon.png +0 -0
  144. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/browserconfig.xml +9 -0
  145. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-16x16.png +0 -0
  146. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-32x32.png +0 -0
  147. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon.ico +0 -0
  148. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/mstile-150x150.png +0 -0
  149. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/safari-pinned-tab.svg +46 -0
  150. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/site.webmanifest +19 -0
  151. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDesktop.svg +56 -0
  152. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoMobile.svg +22 -0
  153. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/unmute.mp3 +0 -0
  154. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +26 -0
  155. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +6 -0
  156. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +3 -1
  157. data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +90 -30
  158. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/create_bundle_symlinks_for_yarn.rake +33 -0
  159. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/dummy.rake +8 -0
  160. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +173 -0
  161. data/entry_types/scrolled/package/config/webpack.js +11 -0
  162. data/entry_types/scrolled/package/contentElements-editor.js +316 -185
  163. data/entry_types/scrolled/package/contentElements-frontend.css +1 -0
  164. data/entry_types/scrolled/package/contentElements-frontend.js +940 -304
  165. data/entry_types/scrolled/package/editor.js +2930 -371
  166. data/entry_types/scrolled/package/frontend-server.js +228 -0
  167. data/entry_types/scrolled/package/frontend/EditableText-7093fd0e.js +1071 -0
  168. data/entry_types/scrolled/package/frontend/Viewer-e49e7807.js +387 -0
  169. data/entry_types/scrolled/package/frontend/Wavesurfer-0adf5667.js +375 -0
  170. data/entry_types/scrolled/package/frontend/components-6a6793ca.js +2534 -0
  171. data/entry_types/scrolled/package/frontend/getPrototypeOf-63c7c8e8.js +86 -0
  172. data/entry_types/scrolled/package/frontend/i18n-4dc6c377.js +1092 -0
  173. data/entry_types/scrolled/package/frontend/index.css +9 -0
  174. data/entry_types/scrolled/package/frontend/index.js +5686 -0
  175. data/entry_types/scrolled/package/frontend/useBrowserFeature-91a4c29d.js +33 -0
  176. data/entry_types/scrolled/package/package.json +30 -9
  177. data/entry_types/scrolled/spec/fixtures/audio.m4a +0 -0
  178. data/entry_types/scrolled/spec/fixtures/video.mp4 +0 -0
  179. data/lib/generators/pageflow/initializer/templates/pageflow.rb +14 -9
  180. data/lib/pageflow/ability_mixin.rb +14 -2
  181. data/lib/pageflow/configuration.rb +6 -5
  182. data/lib/pageflow/entry_export_import/revision_serialization.rb +15 -13
  183. data/lib/pageflow/entry_export_import/revision_serialization/import.rb +18 -26
  184. data/lib/pageflow/entry_type_configuration.rb +2 -0
  185. data/lib/pageflow/global_config_api.rb +5 -4
  186. data/lib/pageflow/nested_revision_component.rb +49 -0
  187. data/lib/pageflow/react.rb +4 -2
  188. data/lib/pageflow/revision_component.rb +6 -2
  189. data/lib/pageflow/themes.rb +4 -0
  190. data/lib/pageflow/user_mixin.rb +2 -1
  191. data/lib/pageflow/version.rb +1 -1
  192. data/{packages/pageflow → package}/config/jest/index.js +8 -2
  193. data/{packages/pageflow → package}/config/jest/transformers/jst.js +0 -0
  194. data/{packages/pageflow → package}/config/jest/transformers/upwardBabel.js +0 -0
  195. data/{packages/pageflow → package}/config/webpack.js +7 -0
  196. data/{packages/pageflow → package}/editor.js +482 -1130
  197. data/package/frontend.js +2553 -0
  198. data/{packages/pageflow → package}/package.json +3 -0
  199. data/{packages/pageflow → package}/testHelpers.js +114 -13
  200. data/{packages/pageflow → package}/ui.js +178 -55
  201. data/spec/factories/accounts.rb +3 -1
  202. data/spec/factories/entry_templates.rb +1 -0
  203. data/spec/factories/published_entries.rb +6 -1
  204. data/spec/factories/test_revision_components.rb +4 -0
  205. metadata +95 -36
  206. data/app/assets/javascripts/pageflow/dist/frontend.js +0 -5800
  207. data/app/assets/javascripts/pageflow/videojs.js +0 -6
  208. data/config/initializers/entry_types.rb +0 -4
  209. data/entry_types/scrolled/config/locales/new/de.yml +0 -269
  210. data/entry_types/scrolled/config/locales/new/en.yml +0 -264
  211. data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +0 -96
  212. data/entry_types/scrolled/package/frontend.js +0 -2879
  213. data/packages/pageflow/config/jest/transformers/cssModules.js +0 -1
@@ -0,0 +1 @@
1
+ .Heading-module_root__33TFw{-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-wrap:break-word;margin-top:.2em;margin-bottom:0;padding-top:.3em}@media (min-width:951px){.Heading-module_right__1TJKF{text-align:right}}.Heading-module_center__38lDY{text-align:center}@media (orientation:landscape){.Heading-module_first__1PMJX{padding-top:25%}}.BeforeAfter-module_sliderStart__2C5cN{background-color:#fff;position:absolute;z-index:1}.BeforeAfter-module_container__2Lm06{height:100%;--frame1pos:-8;--frame2pos:16;--frame3pos:-32;--frame4pos:32;--frame1px:calc(var(--frame1pos)*1px);--frame2px:calc(var(--frame2pos)*1px);--frame3px:calc(var(--frame3pos)*1px);--frame4px:calc(var(--frame4pos)*1px)}.BeforeAfter-module_container__2Lm06>div{height:100%!important}.BeforeAfter-module_container__2Lm06.BeforeAfter-module_wiggle__3nVSe>div>div:nth-child(3){-webkit-animation:BeforeAfter-module_SliderLeftRightShake__2mcn5 1.5s cubic-bezier(.36,.07,.19,.97);animation:BeforeAfter-module_SliderLeftRightShake__2mcn5 1.5s cubic-bezier(.36,.07,.19,.97)}.BeforeAfter-module_container__2Lm06.BeforeAfter-module_wiggle__3nVSe div img:nth-child(2){-webkit-animation:BeforeAfter-module_BeforeImageLeftRightShake__38m9V 1.5s cubic-bezier(.36,.07,.19,.97);animation:BeforeAfter-module_BeforeImageLeftRightShake__38m9V 1.5s cubic-bezier(.36,.07,.19,.97)}.BeforeAfter-module_container__2Lm06 div div:nth-child(4) div{transition:opacity .1s ease-out .3s!important}.BeforeAfter-module_container__2Lm06.BeforeAfter-module_wiggle__3nVSe div img:first-child{-webkit-animation:BeforeAfter-module_AfterImageLeftRightShake__3WMf1 1.5s cubic-bezier(.36,.07,.19,.97);animation:BeforeAfter-module_AfterImageLeftRightShake__3WMf1 1.5s cubic-bezier(.36,.07,.19,.97)}.BeforeAfter-module_container__2Lm06 div div:nth-child(5) div{transition:opacity .1s ease-out .3s!important}@-webkit-keyframes BeforeAfter-module_BeforeImageLeftRightShake__38m9V{0%,to{clip:rect(auto,var(--initial-rect-width),auto,auto)}10%,90%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame1px)),auto,auto)}20%,80%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame2px)),auto,auto)}30%,50%,70%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame3px)),auto,auto)}40%,60%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame4px)),auto,auto)}}@keyframes BeforeAfter-module_BeforeImageLeftRightShake__38m9V{0%,to{clip:rect(auto,var(--initial-rect-width),auto,auto)}10%,90%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame1px)),auto,auto)}20%,80%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame2px)),auto,auto)}30%,50%,70%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame3px)),auto,auto)}40%,60%{clip:rect(auto,calc(var(--initial-rect-width) + var(--frame4px)),auto,auto)}}@-webkit-keyframes BeforeAfter-module_AfterImageLeftRightShake__3WMf1{0%,to{clip:rect(auto,auto,auto,var(--initial-rect-width))}10%,90%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame1px)))}20%,80%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame2px)))}30%,50%,70%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame3px)))}40%,60%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame4px)))}}@keyframes BeforeAfter-module_AfterImageLeftRightShake__3WMf1{0%,to{clip:rect(auto,auto,auto,var(--initial-rect-width))}10%,90%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame1px)))}20%,80%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame2px)))}30%,50%,70%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame3px)))}40%,60%{clip:rect(auto,auto,auto,calc(var(--initial-rect-width) + var(--frame4px)))}}@-webkit-keyframes BeforeAfter-module_SliderLeftRightShake__2mcn5{0%,to{margin-left:0}10%,90%{margin-left:var(--frame1px)}20%,80%{margin-left:var(--frame2px)}30%,50%,70%{margin-left:var(--frame3px)}40%,60%{margin-left:var(--frame4px)}}@keyframes BeforeAfter-module_SliderLeftRightShake__2mcn5{0%,to{margin-left:0}10%,90%{margin-left:var(--frame1px)}20%,80%{margin-left:var(--frame2px)}30%,50%,70%{margin-left:var(--frame3px)}40%,60%{margin-left:var(--frame4px)}}.SoundDisclaimer-module_soundDisclaimer__31hWh{display:grid;border:1px solid;border-radius:4px;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.SoundDisclaimer-module_unmute__1V4Ab,.SoundDisclaimer-module_unmuted__22CJ5{grid-column:1;grid-row:1;display:flex;align-items:center;transition-property:opacity,visibility;transition-duration:.09s;transition-timing-function:ease-out;opacity:0;visibility:hidden;padding:0 15px}.SoundDisclaimer-module_unmute__1V4Ab{position:relative;border:0;background-color:transparent;font:inherit;color:currentColor;text-align:initial;width:100%;z-index:1;cursor:pointer}.SoundDisclaimer-module_active__11_kc{opacity:1;visibility:visible;transition-delay:.09s;transition-duration:.21s;transition-timing-function:ease-in}.SoundDisclaimer-module_soundDisclaimer__31hWh svg{flex:0 0 25px;fill:currentColor;margin-right:15px}.TextBlock-module_text__21Hk4 h2,.TextBlock-module_text__21Hk4 li,.TextBlock-module_text__21Hk4 p{margin:1em 0 0}.TextBlock-module_text__21Hk4 h2{-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-wrap:break-word}.TextBlock-module_text__21Hk4 a{color:currentColor;word-wrap:break-word}.TextBlock-module_text__21Hk4 ol,.TextBlock-module_text__21Hk4 ul{margin:0;padding-left:20px;clear:both}.TextBlock-module_text__21Hk4 blockquote{padding:.5em 1em .5em 2em;margin:1em 0 0 .5em;position:relative;overflow:hidden}.TextBlock-module_text__21Hk4 blockquote:before{content:"\201C";font-size:3em;font-weight:700;color:#aaa;position:absolute;top:0;left:0;line-height:1em}.VideoEmbed-module_VideoEmbed__3BUjc{background-color:#000;color:#fff}.VideoEmbed-module_embedPlayer__54NKG{position:absolute;top:0;left:0;bottom:0;right:0}.ExternalLink-module_hidden__3jer0{display:none}.ExternalLink-module_link_item__Blypv{width:45%;vertical-align:top;margin:2% auto;background-color:#fff;color:#000;text-decoration:none;transition:transform .3s}.ExternalLink-module_link_item__Blypv.ExternalLink-module_invert__1zrgN{background-color:#222;color:#fff}.ExternalLink-module_link_item__Blypv.ExternalLink-module_layout_center__3NRpQ{width:29%}.ExternalLink-module_link_item__Blypv:hover{transform:scale(1.05)}.ExternalLink-module_link_item__Blypv:hover .ExternalLink-module_link_title__FZJ-0{text-decoration:underline}.ExternalLink-module_link_thumbnail__2_BHq{width:auto;background-repeat:no-repeat;background-size:cover;padding-top:56.25%;position:relative}.ExternalLink-module_link_details__lRhKU{margin:20px}.ExternalLink-module_link_details__lRhKU>.ExternalLink-module_link_title__FZJ-0{font-size:1.2em;font-weight:700;margin-bottom:20px}.ExternalLink-module_link_details__lRhKU>p{width:100%;white-space:normal;line-height:1.3em}.ExternalLink-module_tooltip__18MpC{position:absolute;left:50%;top:80px;width:180px;padding:5px;margin-left:-95px;background-color:#444;color:#fff;border:1px solid #fff;opacity:.9;font-size:13px;text-align:center;white-space:normal}.ExternalLink-module_tooltip__18MpC>span{display:block;color:#fff;text-decoration:underline}@media only screen and (max-width:600px){.ExternalLink-module_link_item__Blypv.ExternalLink-module_layout_center__3NRpQ{width:45%}}@media only screen and (max-width:350px){.ExternalLink-module_link_item__Blypv,.ExternalLink-module_link_item__Blypv.ExternalLink-module_layout_center__3NRpQ{width:85%}}.ExternalLinkList-module_ext_links_container__16IIo{display:flex;flex-wrap:wrap;border-collapse:separate;border-spacing:10px;min-height:240px;width:auto;height:auto;pointer-events:auto;position:relative;transition:opacity .5s;transition-timing-function:cubic-bezier(.1,.57,.1,1);transition-duration:0ms}.DataWrapperChart-module_container__2eZ15{min-height:200px;padding:20px 5%}.DataWrapperChart-module_container__2eZ15>iframe{width:100%;height:100%;position:relative;top:0;border:0}
@@ -1,7 +1,9 @@
1
- import { Text, frontend, useFile, useEditorSelection, useOnScreen, Image, InlineCaption, Video, useMediaSettings, useI18n } from 'pageflow-scrolled/frontend';
2
- import React, { useRef, useState, useEffect } from 'react';
1
+ import { useContentElementConfigurationUpdate, useI18n, withShadowClassName, Text, EditableInlineText, frontend, useFile, useContentElementEditorState, ViewportDependentPillarBoxes, useContentElementLifecycle, Figure, Image, usePlayerState, useAudioFocus, MediaInteractionTracking, VideoPlayerControls, VideoPlayer, AudioPlayerControls, AudioPlayer, useMediaMuted, EditableText, ThirdPartyOptOutInfo, ThirdPartyOptIn, useDarkBackground, textColorForBackgroundColor, Panorama } from 'pageflow-scrolled/frontend';
2
+ import React, { useState, useEffect, useRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import ReactCompareImage from 'react-compare-image';
5
+ import Measure from 'react-measure';
6
+ import { media } from 'pageflow/frontend';
5
7
  import ReactPlayer from 'react-player';
6
8
 
7
9
  function _defineProperty(obj, key, value) {
@@ -19,60 +21,89 @@ function _defineProperty(obj, key, value) {
19
21
  return obj;
20
22
  }
21
23
 
22
- function styleInject(css, ref) {
23
- if ( ref === void 0 ) ref = {};
24
- var insertAt = ref.insertAt;
24
+ var styles = {"root":"Heading-module_root__33TFw","right":"Heading-module_right__1TJKF","center":"Heading-module_center__38lDY","first":"Heading-module_first__1PMJX"};
25
25
 
26
- if (!css || typeof document === 'undefined') { return; }
26
+ function Heading(_ref) {
27
+ var configuration = _ref.configuration,
28
+ sectionProps = _ref.sectionProps;
29
+ var level = configuration.level || sectionProps.sectionIndex;
30
+ var firstSectionInEntry = level === 0;
31
+ var updateConfiguration = useContentElementConfigurationUpdate();
32
+
33
+ var _useI18n = useI18n({
34
+ locale: 'ui'
35
+ }),
36
+ t = _useI18n.t;
27
37
 
28
- var head = document.head || document.getElementsByTagName('head')[0];
29
- var style = document.createElement('style');
30
- style.type = 'text/css';
38
+ var legacyValue = configuration.children;
39
+ return (
40
+ /*#__PURE__*/
41
+ React.createElement("h1", {
42
+ className: classNames(styles.root, _defineProperty({}, styles.first, firstSectionInEntry), _defineProperty({}, styles[sectionProps.layout], configuration.position === 'wide'), _defineProperty({}, withShadowClassName, !sectionProps.invert))
43
+ },
44
+ /*#__PURE__*/
45
+ React.createElement(Text, {
46
+ scaleCategory: firstSectionInEntry ? 'h1' : 'h2',
47
+ inline: true
48
+ },
49
+ /*#__PURE__*/
50
+ React.createElement(EditableInlineText, {
51
+ value: configuration.value,
52
+ defaultValue: legacyValue,
53
+ placeholder: firstSectionInEntry ? t('pageflow_scrolled.inline_editing.type_title') : t('pageflow_scrolled.inline_editing.type_heading'),
54
+ onChange: function onChange(value) {
55
+ return updateConfiguration({
56
+ value: value
57
+ });
58
+ }
59
+ })))
60
+ );
61
+ }
31
62
 
32
- if (insertAt === 'top') {
33
- if (head.firstChild) {
34
- head.insertBefore(style, head.firstChild);
35
- } else {
36
- head.appendChild(style);
37
- }
38
- } else {
39
- head.appendChild(style);
40
- }
63
+ frontend.contentElementTypes.register('heading', {
64
+ component: Heading
65
+ });
41
66
 
42
- if (style.styleSheet) {
43
- style.styleSheet.cssText = css;
44
- } else {
45
- style.appendChild(document.createTextNode(css));
67
+ function ownKeys(object, enumerableOnly) {
68
+ var keys = Object.keys(object);
69
+
70
+ if (Object.getOwnPropertySymbols) {
71
+ var symbols = Object.getOwnPropertySymbols(object);
72
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
73
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
74
+ });
75
+ keys.push.apply(keys, symbols);
46
76
  }
77
+
78
+ return keys;
47
79
  }
48
80
 
49
- var css = ".Heading-module_root__33TFw {\n margin-top: 0.2em;\n margin-bottom: 0.5em;\n padding-top: 0.3em;\n}\n\n@media (orientation: landscape) {\n .Heading-module_first__1PMJX {\n padding-top: 25%;\n }\n}\n";
50
- var styles = {"root":"Heading-module_root__33TFw","first":"Heading-module_first__1PMJX"};
51
- styleInject(css);
81
+ function _objectSpread2(target) {
82
+ for (var i = 1; i < arguments.length; i++) {
83
+ var source = arguments[i] != null ? arguments[i] : {};
52
84
 
53
- function Heading(_ref) {
54
- var configuration = _ref.configuration;
55
- return React.createElement("h1", {
56
- className: classNames(styles.root, _defineProperty({}, styles.first, configuration.first))
57
- }, React.createElement(Text, {
58
- scaleCategory: configuration.first ? 'h1' : 'h2',
59
- inline: true
60
- }, configuration.children));
61
- }
85
+ if (i % 2) {
86
+ ownKeys(Object(source), true).forEach(function (key) {
87
+ _defineProperty(target, key, source[key]);
88
+ });
89
+ } else if (Object.getOwnPropertyDescriptors) {
90
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
91
+ } else {
92
+ ownKeys(Object(source)).forEach(function (key) {
93
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
94
+ });
95
+ }
96
+ }
62
97
 
63
- frontend.contentElementTypes.register('heading', {
64
- component: Heading
65
- });
98
+ return target;
99
+ }
66
100
 
67
101
  function _arrayWithHoles(arr) {
68
102
  if (Array.isArray(arr)) return arr;
69
103
  }
70
104
 
71
105
  function _iterableToArrayLimit(arr, i) {
72
- if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
73
- return;
74
- }
75
-
106
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
76
107
  var _arr = [];
77
108
  var _n = true;
78
109
  var _d = false;
@@ -98,25 +129,45 @@ function _iterableToArrayLimit(arr, i) {
98
129
  return _arr;
99
130
  }
100
131
 
132
+ function _arrayLikeToArray(arr, len) {
133
+ if (len == null || len > arr.length) len = arr.length;
134
+
135
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
136
+ arr2[i] = arr[i];
137
+ }
138
+
139
+ return arr2;
140
+ }
141
+
142
+ function _unsupportedIterableToArray(o, minLen) {
143
+ if (!o) return;
144
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
145
+ var n = Object.prototype.toString.call(o).slice(8, -1);
146
+ if (n === "Object" && o.constructor) n = o.constructor.name;
147
+ if (n === "Map" || n === "Set") return Array.from(n);
148
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
149
+ }
150
+
101
151
  function _nonIterableRest() {
102
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
152
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
103
153
  }
104
154
 
105
155
  function _slicedToArray(arr, i) {
106
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
156
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
107
157
  }
108
158
 
109
- var css$1 = ".BeforeAfter-module_sliderStart__2C5cN {\n background-color: white;\n position: absolute;\n z-index: 1;\n}\n\n.BeforeAfter-module_container__2Lm06 {\n /* slider default position: 50%, spacing around labels in\n react-compare-image: 5% each side, so default label max width\n should be 40%. This is only a fallback. We should receive widths\n from BeforeAfter.js */\n --default-label-max-width: 40%;\n /* label padding in react-compare-image is set to 20px left and right,\n so we need to subtract the sum from max width */\n --label-padding: 40px;\n --wiggle-animation: 1.5s cubic-bezier(.36,.07,.19,.97) both;\n --frame1pos: -8;\n --frame2pos: 16;\n --frame3pos: -32;\n --frame4pos: 32;\n --frame1px: calc(var(--frame1pos) * 1px);\n --frame2px: calc(var(--frame2pos) * 1px);\n --frame3px: calc(var(--frame3pos) * 1px);\n --frame4px: calc(var(--frame4pos) * 1px);\n --frame1percent: calc(var(--frame1pos) * 2.5%);\n --frame2percent: calc(var(--frame2pos) * 2.5%);\n --frame3percent: calc(var(--frame3pos) * 2.5%);\n --frame4percent: calc(var(--frame4pos) * 2.5%);\n /* in addition to the above variables, we receive --initial-rect-width\n from BeforeAfter.js, which has no sensible default value */\n}\n\n/* With react-compare-image 2.0.4 (commit 7410d14), this selects the\n slider */\n.BeforeAfter-module_container__2Lm06.BeforeAfter-module_wiggle__3nVSe div div:nth-child(3) {\n animation: BeforeAfter-module_SliderLeftRightShake__2mcn5 var(--wiggle-animation);\n}\n\n/* With react-compare-image 2.0.4 (commit 7410d14), this selects the\n before image */\n.BeforeAfter-module_container__2Lm06.BeforeAfter-module_wiggle__3nVSe div img:nth-child(2) {\n animation: BeforeAfter-module_BeforeImageLeftRightShake__38m9V var(--wiggle-animation);\n}\n\n/* With react-compare-image 2.0.4 (commit 7410d14), this selects the\n before label */\n.BeforeAfter-module_container__2Lm06 div div:nth-child(4) div {\n max-width: calc(var(--before-label-max-width, var(--default-label-max-width)) -\n var(--label-padding));\n}\n\n/* With react-compare-image 2.0.4 (commit 7410d14), this selects the\n after image */\n.BeforeAfter-module_container__2Lm06.BeforeAfter-module_wiggle__3nVSe div img:nth-child(1) {\n animation: BeforeAfter-module_AfterImageLeftRightShake__3WMf1 var(--wiggle-animation);\n}\n\n/* With react-compare-image 2.0.4 (commit 7410d14), this selects the\n after label */\n.BeforeAfter-module_container__2Lm06 div div:nth-child(5) div {\n max-width: calc(var(--after-label-max-width, var(--default-label-max-width)) -\n var(--label-padding));\n}\n\n@keyframes BeforeAfter-module_BeforeImageLeftRightShake__38m9V {\n 10%, 90% {\n clip: rect(auto, calc(var(--initial-rect-width) + var(--frame1px)), auto, auto);\n }\n\n 20%, 80% {\n clip: rect(auto, calc(var(--initial-rect-width) + var(--frame2px)), auto, auto);\n }\n\n 30%, 50%, 70% {\n clip: rect(auto, calc(var(--initial-rect-width) + var(--frame3px)), auto, auto);\n }\n\n 40%, 60% {\n clip: rect(auto, calc(var(--initial-rect-width) + var(--frame4px)), auto, auto);\n }\n}\n\n@keyframes BeforeAfter-module_AfterImageLeftRightShake__3WMf1 {\n 10%, 90% {\n clip: rect(auto, auto, auto, calc(var(--initial-rect-width) + var(--frame1px)));\n }\n\n 20%, 80% {\n clip: rect(auto, auto, auto, calc(var(--initial-rect-width) + var(--frame2px)));\n }\n\n 30%, 50%, 70% {\n clip: rect(auto, auto, auto, calc(var(--initial-rect-width) + var(--frame3px)));\n }\n\n 40%, 60% {\n clip: rect(auto, auto, auto, calc(var(--initial-rect-width) + var(--frame4px)));\n }\n}\n\n@keyframes BeforeAfter-module_SliderLeftRightShake__2mcn5 {\n 10%, 90% {\n transform: translate3d(var(--frame1percent), 0, 0);\n }\n\n 20%, 80% {\n transform: translate3d(var(--frame2percent), 0, 0);\n }\n\n 30%, 50%, 70% {\n transform: translate3d(var(--frame3percent), 0, 0);\n }\n\n 40%, 60% {\n transform: translate3d(var(--frame4percent), 0, 0);\n }\n}\n";
110
159
  var styles$1 = {"sliderStart":"BeforeAfter-module_sliderStart__2C5cN","container":"BeforeAfter-module_container__2Lm06","wiggle":"BeforeAfter-module_wiggle__3nVSe","SliderLeftRightShake":"BeforeAfter-module_SliderLeftRightShake__2mcn5","BeforeImageLeftRightShake":"BeforeAfter-module_BeforeImageLeftRightShake__38m9V","AfterImageLeftRightShake":"BeforeAfter-module_AfterImageLeftRightShake__3WMf1"};
111
- styleInject(css$1);
112
-
113
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
114
160
 
115
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
161
+ var placeholderForBeforeImage = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQwIiBoZWlnaHQ9IjQwMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KIDwhLS0gQ3JlYXRlZCB3aXRoIE1ldGhvZCBEcmF3IC0gaHR0cDovL2dpdGh1Yi5jb20vZHVvcGl4ZWwvTWV0aG9kLURyYXcvIC0tPgogPGc+CiAgPHRpdGxlPmJhY2tncm91bmQ8L3RpdGxlPgogIDxyZWN0IGZpbGw9IiMzZDVhODAiIGlkPSJjYW52YXNfYmFja2dyb3VuZCIgaGVpZ2h0PSI0MDUiIHdpZHRoPSI2NDIiIHk9Ii0xIiB4PSItMSIvPgogIDxnIGRpc3BsYXk9Im5vbmUiIG92ZXJmbG93PSJ2aXNpYmxlIiB5PSIwIiB4PSIwIiBoZWlnaHQ9IjEwMCUiIHdpZHRoPSIxMDAlIiBpZD0iY2FudmFzR3JpZCI+CiAgIDxyZWN0IGZpbGw9InVybCgjZ3JpZHBhdHRlcm4pIiBzdHJva2Utd2lkdGg9IjAiIHk9IjAiIHg9IjAiIGhlaWdodD0iMTAwJSIgd2lkdGg9IjEwMCUiLz4KICA8L2c+CiA8L2c+CiA8Zz4KICA8dGl0bGU+TGF5ZXIgMTwvdGl0bGU+CiA8L2c+Cjwvc3ZnPg==';
162
+ var placeholderForAfterImage = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQwIiBoZWlnaHQ9IjQwMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KIDwhLS0gQ3JlYXRlZCB3aXRoIE1ldGhvZCBEcmF3IC0gaHR0cDovL2dpdGh1Yi5jb20vZHVvcGl4ZWwvTWV0aG9kLURyYXcvIC0tPgogPGc+CiAgPHRpdGxlPmJhY2tncm91bmQ8L3RpdGxlPgogIDxyZWN0IGZpbGw9IiM5OGMxZDkiIGlkPSJjYW52YXNfYmFja2dyb3VuZCIgaGVpZ2h0PSI0MDUiIHdpZHRoPSI2NDIiIHk9Ii0xIiB4PSItMSIvPgogIDxnIGRpc3BsYXk9Im5vbmUiIG92ZXJmbG93PSJ2aXNpYmxlIiB5PSIwIiB4PSIwIiBoZWlnaHQ9IjEwMCUiIHdpZHRoPSIxMDAlIiBpZD0iY2FudmFzR3JpZCI+CiAgIDxyZWN0IGZpbGw9InVybCgjZ3JpZHBhdHRlcm4pIiBzdHJva2Utd2lkdGg9IjAiIHk9IjAiIHg9IjAiIGhlaWdodD0iMTAwJSIgd2lkdGg9IjEwMCUiLz4KICA8L2c+CiA8L2c+CiA8Zz4KICA8dGl0bGU+TGF5ZXIgMTwvdGl0bGU+CiA8L2c+Cjwvc3ZnPg==';
163
+ var placeholderFile = {
164
+ width: 640,
165
+ height: 403
166
+ };
116
167
  function BeforeAfter(_ref) {
117
- var _cx;
118
-
119
- var state = _ref.state,
168
+ var isActive = _ref.isActive,
169
+ load = _ref.load,
170
+ position = _ref.position,
120
171
  before_id = _ref.before_id,
121
172
  before_label = _ref.before_label,
122
173
  after_id = _ref.after_id,
@@ -124,34 +175,25 @@ function BeforeAfter(_ref) {
124
175
  initial_slider_position = _ref.initial_slider_position,
125
176
  slider = _ref.slider,
126
177
  slider_color = _ref.slider_color,
127
- slider_handle = _ref.slider_handle,
128
- contentElementId = _ref.contentElementId;
129
- var beforeAfterRef = useRef();
130
- var current = beforeAfterRef.current;
178
+ slider_handle = _ref.slider_handle;
131
179
 
132
180
  var _useState = useState(false),
133
181
  _useState2 = _slicedToArray(_useState, 2),
134
- wiggled = _useState2[0],
135
- setWiggled = _useState2[1];
182
+ wiggle = _useState2[0],
183
+ setWiggle = _useState2[1];
136
184
 
137
185
  var _useState3 = useState(false),
138
186
  _useState4 = _slicedToArray(_useState3, 2),
139
- wiggle = _useState4[0],
140
- setWiggle = _useState4[1];
187
+ moved = _useState4[0],
188
+ setMoved = _useState4[1];
141
189
 
142
190
  useEffect(function () {
143
- var node = current;
144
-
145
- if (node) {
146
- // Only wiggle once per element, when it is active for the first
147
- // time
148
- var shouldWiggle = !wiggled && state === 'active';
149
- setWiggle(shouldWiggle); // If wiggle was just set, mark this element as one that already
150
- // wiggled
151
-
152
- !wiggled && setWiggled(shouldWiggle);
153
- }
154
- }, [state, current]);
191
+ // Only wiggle once per element, when it is active for the first
192
+ // time
193
+ setWiggle(function (wiggle) {
194
+ return wiggle || isActive;
195
+ });
196
+ }, [isActive]);
155
197
  var beforeImage = useFile({
156
198
  collectionName: 'imageFiles',
157
199
  permaId: before_id
@@ -161,11 +203,8 @@ function BeforeAfter(_ref) {
161
203
  permaId: after_id
162
204
  });
163
205
 
164
- var _useEditorSelection = useEditorSelection({
165
- id: contentElementId,
166
- type: 'contentElement'
167
- }),
168
- isSelected = _useEditorSelection.isSelected;
206
+ var _useContentElementEdi = useContentElementEditorState(),
207
+ isSelected = _useContentElementEdi.isSelected;
169
208
 
170
209
  var beforeImageUrl = beforeImage && beforeImage.urls.large;
171
210
  var beforeImageAlt = beforeImage && beforeImage.configuration.alt;
@@ -176,64 +215,88 @@ function BeforeAfter(_ref) {
176
215
  // react-compare-image needs
177
216
 
178
217
  if (!slider) {
179
- opts = _objectSpread({}, opts, {
218
+ opts = _objectSpread2(_objectSpread2({}, opts), {}, {
180
219
  sliderLineWidth: 0,
181
- handle: React.createElement(React.Fragment, null)
220
+ handle:
221
+ /*#__PURE__*/
222
+ React.createElement(React.Fragment, null)
182
223
  });
183
224
  }
184
225
 
185
226
  if (slider) {
186
227
  if (!slider_handle) {
187
- opts = _objectSpread({}, opts, {
188
- handle: React.createElement(React.Fragment, null)
228
+ opts = _objectSpread2(_objectSpread2({}, opts), {}, {
229
+ handle:
230
+ /*#__PURE__*/
231
+ React.createElement(React.Fragment, null)
189
232
  });
190
233
  }
191
234
 
192
235
  if (slider_color) {
193
- opts = _objectSpread({}, opts, {
236
+ opts = _objectSpread2(_objectSpread2({}, opts), {}, {
194
237
  sliderLineColor: slider_color
195
238
  });
196
239
  }
197
240
  }
198
241
 
199
- if (current) {
200
- // Size labels according to initial slider position. Unit is %,
201
- // left and right spacing is 5%, so we subtract 10. 90 = 100 - 10.
202
- var beforeLabelWidth = initial_slider_position - 10;
203
- var afterLabelWidth = 90 - initial_slider_position; // Compute initial slider coordinate and pass it as a CSS
204
- // variable, so that before/after images can wiggle together with
205
- // the slider
206
-
207
- var containerWidth = current.getBoundingClientRect().width;
208
- var initialRectWidth = initialSliderPos * containerWidth;
209
- current.style.setProperty('--before-label-max-width', beforeLabelWidth + '%');
210
- current.style.setProperty('--after-label-max-width', afterLabelWidth + '%');
211
- current.style.setProperty('--initial-rect-width', initialRectWidth + 'px');
212
- }
213
-
214
- return React.createElement("div", {
215
- ref: beforeAfterRef,
216
- className: classNames((_cx = {}, _defineProperty(_cx, styles$1.selected, isSelected), _defineProperty(_cx, styles$1.wiggle, wiggle), _cx), styles$1.container)
217
- }, React.createElement(InitialSliderPositionIndicator, {
218
- parentSelected: isSelected,
219
- position: initial_slider_position
220
- }), React.createElement(ReactCompareImage, Object.assign({
221
- leftImage: beforeImageUrl,
222
- rightImage: afterImageUrl,
223
- leftImageLabel: before_label,
224
- rightImageLabel: after_label,
225
- leftImageAlt: beforeImageAlt,
226
- rightImageAlt: afterImageAlt,
227
- sliderPositionPercentage: initialSliderPos,
228
- onSliderPositionChange: function onSliderPositionChange() {
229
- return setWiggle(false);
242
+ return (
243
+ /*#__PURE__*/
244
+ React.createElement(ViewportDependentPillarBoxes, {
245
+ file: beforeImage || afterImage || placeholderFile,
246
+ position: position
247
+ },
248
+ /*#__PURE__*/
249
+ React.createElement(Measure, {
250
+ bounds: true
251
+ }, function (_ref2) {
252
+ var _cx;
253
+
254
+ var measureRef = _ref2.measureRef,
255
+ contentRect = _ref2.contentRect;
256
+ return (
257
+ /*#__PURE__*/
258
+ React.createElement("div", {
259
+ ref: measureRef,
260
+ style: {
261
+ '--initial-rect-width': contentRect.bounds.width * initialSliderPos + 'px'
262
+ },
263
+ className: classNames((_cx = {}, _defineProperty(_cx, styles$1.selected, isSelected), _defineProperty(_cx, styles$1.wiggle, wiggle && !moved), _cx), styles$1.container)
264
+ },
265
+ /*#__PURE__*/
266
+ React.createElement(InitialSliderPositionIndicator, {
267
+ parentSelected: isSelected,
268
+ position: initial_slider_position
269
+ }), renderCompareImage())
270
+ );
271
+ }))
272
+ );
273
+
274
+ function renderCompareImage() {
275
+ if (!load) {
276
+ return null;
230
277
  }
231
- }, opts)));
278
+
279
+ return (
280
+ /*#__PURE__*/
281
+ React.createElement(ReactCompareImage, Object.assign({
282
+ leftImage: beforeImage ? beforeImageUrl : placeholderForBeforeImage,
283
+ rightImage: afterImage ? afterImageUrl : placeholderForAfterImage,
284
+ leftImageLabel: before_label,
285
+ rightImageLabel: after_label,
286
+ leftImageAlt: beforeImageAlt,
287
+ rightImageAlt: afterImageAlt,
288
+ sliderPositionPercentage: initialSliderPos,
289
+ onSliderPositionChange: function onSliderPositionChange() {
290
+ return setMoved(true);
291
+ }
292
+ }, opts))
293
+ );
294
+ }
232
295
  }
233
296
 
234
- function InitialSliderPositionIndicator(_ref2) {
235
- var parentSelected = _ref2.parentSelected,
236
- position = _ref2.position;
297
+ function InitialSliderPositionIndicator(_ref3) {
298
+ var parentSelected = _ref3.parentSelected,
299
+ position = _ref3.position;
237
300
  var indicatorWidth = '2px';
238
301
  var indicatorStyles = {
239
302
  left: "calc(".concat(position, "% - ").concat(indicatorWidth, "/2)"),
@@ -244,207 +307,611 @@ function InitialSliderPositionIndicator(_ref2) {
244
307
  }; // In case this element is selected, and its initial slider position
245
308
  // is not in the middle, we show InitialSliderPositionIndicator
246
309
 
247
- return parentSelected && position !== 50 ? React.createElement("div", {
310
+ return parentSelected && position !== 50 ?
311
+ /*#__PURE__*/
312
+ React.createElement("div", {
248
313
  className: styles$1.sliderStart,
249
314
  style: indicatorStyles
250
315
  }) : '';
251
316
  }
252
317
 
253
- var css$2 = ".InlineBeforeAfter-module_root__1f5oG {\n position: relative;\n margin: 0 auto;\n}\n";
254
- var styles$2 = {"root":"InlineBeforeAfter-module_root__1f5oG"};
255
- styleInject(css$2);
256
-
257
318
  function InlineBeforeAfter(props) {
258
- var ref = useRef();
259
- var onScreen = useOnScreen(ref, '-50% 0px -50% 0px');
260
- return React.createElement("div", {
261
- ref: ref,
262
- className: styles$2.root
263
- }, React.createElement(BeforeAfter, Object.assign({}, props.configuration, {
264
- state: onScreen ? 'active' : 'inactive',
265
- contentElementId: props.contentElementId
266
- })));
319
+ var _useContentElementLif = useContentElementLifecycle(),
320
+ isActive = _useContentElementLif.isActive,
321
+ shouldLoad = _useContentElementLif.shouldLoad;
322
+
323
+ return (
324
+ /*#__PURE__*/
325
+ React.createElement(BeforeAfter, Object.assign({}, props.configuration, {
326
+ load: shouldLoad,
327
+ isActive: isActive
328
+ }))
329
+ );
267
330
  }
268
331
 
269
332
  frontend.contentElementTypes.register('inlineBeforeAfter', {
270
- component: InlineBeforeAfter
333
+ component: InlineBeforeAfter,
334
+ lifecycle: true
271
335
  });
272
336
 
273
- var css$3 = ".InlineImage-module_root__3edeH {\n position: relative;\n margin-top: 1em;\n}\n\n.InlineImage-module_container__30JBC {\n position: relative;\n margin-top: 1em;\n}\n\n.InlineImage-module_spacer__2yTJT {\n padding-top: 75%;\n}\n\n.InlineImage-module_inner__3WcPa {\n border: solid 2px #fff;\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n";
274
- var styles$3 = {"root":"InlineImage-module_root__3edeH","container":"InlineImage-module_container__30JBC","spacer":"InlineImage-module_spacer__2yTJT","inner":"InlineImage-module_inner__3WcPa"};
275
- styleInject(css$3);
276
-
277
337
  function InlineImage(_ref) {
278
338
  var configuration = _ref.configuration;
279
- return React.createElement("div", {
280
- className: classNames(styles$3.root)
281
- }, React.createElement("div", {
282
- className: styles$3.container
283
- }, React.createElement("div", {
284
- className: styles$3.spacer
285
- }, React.createElement("div", {
286
- className: styles$3.inner
287
- }, React.createElement(Image, configuration)))), React.createElement(InlineCaption, {
288
- text: configuration.caption
289
- }));
339
+
340
+ var _useContentElementLif = useContentElementLifecycle(),
341
+ shouldLoad = _useContentElementLif.shouldLoad;
342
+
343
+ var imageFile = useFile({
344
+ collectionName: 'imageFiles',
345
+ permaId: configuration.id
346
+ });
347
+ return (
348
+ /*#__PURE__*/
349
+ React.createElement(Figure, {
350
+ caption: configuration.caption
351
+ },
352
+ /*#__PURE__*/
353
+ React.createElement(ViewportDependentPillarBoxes, {
354
+ file: imageFile,
355
+ aspectRatio: imageFile ? undefined : 0.75,
356
+ position: configuration.position,
357
+ opaque: !!configuration.caption
358
+ },
359
+ /*#__PURE__*/
360
+ React.createElement(Image, {
361
+ imageFile: imageFile,
362
+ load: shouldLoad,
363
+ structuredData: true,
364
+ variant: configuration.position === 'full' ? 'large' : 'medium'
365
+ })))
366
+ );
290
367
  }
291
368
 
292
369
  frontend.contentElementTypes.register('inlineImage', {
293
- component: InlineImage
370
+ component: InlineImage,
371
+ lifecycle: true
294
372
  });
295
373
 
296
- var css$4 = ".InlineVideo-module_root__26uiY {\n position: relative;\n max-height: 98vh;\n}\n\n.InlineVideo-module_inner__3n7y4 {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n\n/* Timeline in native video controls is hidden in Storybook to prevent\n Percy from detecting different loading progress as visual\n change. See .storybook/preview-head.html file. */\n";
297
- var styles$4 = {"root":"InlineVideo-module_root__26uiY","inner":"InlineVideo-module_inner__3n7y4"};
298
- styleInject(css$4);
299
-
300
374
  function InlineVideo(_ref) {
301
- var configuration = _ref.configuration;
302
- var ref = useRef();
303
- var onScreen = useOnScreen(ref, '-50% 0px -50% 0px');
304
- return React.createElement("div", {
305
- ref: ref,
306
- className: classNames(styles$4.root)
307
- }, React.createElement("div", {
308
- style: {
309
- paddingTop: configuration.wideFormat ? '41.15%' : '56.25%'
375
+ var contentElementId = _ref.contentElementId,
376
+ sectionProps = _ref.sectionProps,
377
+ configuration = _ref.configuration;
378
+ var videoFile = useFile({
379
+ collectionName: 'videoFiles',
380
+ permaId: configuration.id
381
+ });
382
+ var posterImageFile = useFile({
383
+ collectionName: 'imageFiles',
384
+ permaId: configuration.posterId
385
+ });
386
+
387
+ var _usePlayerState = usePlayerState(),
388
+ _usePlayerState2 = _slicedToArray(_usePlayerState, 2),
389
+ playerState = _usePlayerState2[0],
390
+ playerActions = _usePlayerState2[1];
391
+
392
+ var _useContentElementEdi = useContentElementEditorState(),
393
+ isEditable = _useContentElementEdi.isEditable,
394
+ isSelected = _useContentElementEdi.isSelected;
395
+
396
+ var _useContentElementLif = useContentElementLifecycle({
397
+ onActivate: function onActivate() {
398
+ if (configuration.autoplay) {
399
+ playerActions.play();
400
+ }
401
+ },
402
+ onDeactivate: function onDeactivate() {
403
+ playerActions.fadeOutAndPause(400);
310
404
  }
311
- }, React.createElement("div", {
312
- className: styles$4.inner
313
- }, React.createElement(Video, Object.assign({}, configuration, {
314
- state: onScreen ? 'active' : 'inactive',
315
- interactive: true
316
- })))));
405
+ }),
406
+ shouldLoad = _useContentElementLif.shouldLoad,
407
+ shouldPrepare = _useContentElementLif.shouldPrepare;
408
+
409
+ useAudioFocus({
410
+ key: contentElementId,
411
+ request: playerState.shouldPlay,
412
+ onLost: function onLost() {
413
+ playerActions.fadeOutAndPause(400);
414
+ }
415
+ });
416
+
417
+ var onPlayerClick = function onPlayerClick() {
418
+ if (isEditable && !isSelected) {
419
+ return;
420
+ }
421
+
422
+ if (!playerState.shouldPlay || media.muted) {
423
+ playerActions.playBlessed();
424
+ } else {
425
+ playerActions.pause();
426
+ }
427
+ };
428
+
429
+ return (
430
+ /*#__PURE__*/
431
+ React.createElement(Figure, {
432
+ caption: configuration.caption
433
+ },
434
+ /*#__PURE__*/
435
+ React.createElement(MediaInteractionTracking, {
436
+ playerState: playerState,
437
+ playerActions: playerActions
438
+ },
439
+ /*#__PURE__*/
440
+ React.createElement(VideoPlayerControls, {
441
+ videoFile: videoFile,
442
+ defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
443
+ playerState: playerState,
444
+ playerActions: playerActions,
445
+ configuration: configuration,
446
+ sectionProps: sectionProps,
447
+ onPlayerClick: onPlayerClick
448
+ },
449
+ /*#__PURE__*/
450
+ React.createElement(VideoPlayer, {
451
+ load: shouldPrepare ? 'auto' : shouldLoad ? 'poster' : 'none',
452
+ position: configuration.position,
453
+ controls: configuration.controls,
454
+ playerState: playerState,
455
+ playerActions: playerActions,
456
+ videoFile: videoFile,
457
+ posterImageFile: posterImageFile,
458
+ defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
459
+ quality: 'high',
460
+ playsInline: true,
461
+ atmoDuringPlayback: configuration.atmoDuringPlayback
462
+ }))))
463
+ );
317
464
  }
318
465
 
319
466
  frontend.contentElementTypes.register('inlineVideo', {
320
- component: InlineVideo
467
+ component: InlineVideo,
468
+ lifecycle: true
321
469
  });
322
470
 
323
- var css$5 = ".SoundDisclaimer-module_soundDisclaimer__31hWh {\n text-align: center;\n border: 1px solid white;\n border-radius: 4px;\n cursor: pointer;\n font-size: inherit;\n}\n\n.SoundDisclaimer-module_soundDisclaimer__31hWh:hover {\n background: rgba(255, 255, 255, 0.25);\n}";
324
- var styles$5 = {"soundDisclaimer":"SoundDisclaimer-module_soundDisclaimer__31hWh"};
325
- styleInject(css$5);
471
+ function InlineAudio(_ref) {
472
+ var contentElementId = _ref.contentElementId,
473
+ sectionProps = _ref.sectionProps,
474
+ configuration = _ref.configuration;
475
+ var audioFile = useFile({
476
+ collectionName: 'audioFiles',
477
+ permaId: configuration.id
478
+ });
479
+ var posterImageFile = useFile({
480
+ collectionName: 'imageFiles',
481
+ permaId: configuration.posterId
482
+ });
326
483
 
327
- function SoundDisclaimer() {
328
- var mediaSettings = useMediaSettings();
484
+ var _usePlayerState = usePlayerState(),
485
+ _usePlayerState2 = _slicedToArray(_usePlayerState, 2),
486
+ playerState = _usePlayerState2[0],
487
+ playerActions = _usePlayerState2[1];
329
488
 
330
- var _useI18n = useI18n(),
331
- t = _useI18n.t;
489
+ var _useContentElementEdi = useContentElementEditorState(),
490
+ isEditable = _useContentElementEdi.isEditable,
491
+ isSelected = _useContentElementEdi.isSelected;
332
492
 
333
- return React.createElement("div", {
334
- className: classNames(styles$5.soundDisclaimer),
335
- onClick: function onClick() {
336
- return mediaSettings.setMuted(false);
493
+ var _useContentElementLif = useContentElementLifecycle({
494
+ onActivate: function onActivate() {
495
+ if (configuration.autoplay && !media.muted) {
496
+ playerActions.play();
497
+ }
498
+ },
499
+ onDeactivate: function onDeactivate() {
500
+ playerActions.fadeOutAndPause(400);
501
+ }
502
+ }),
503
+ shouldLoad = _useContentElementLif.shouldLoad,
504
+ shouldPrepare = _useContentElementLif.shouldPrepare;
505
+
506
+ useAudioFocus({
507
+ key: contentElementId,
508
+ request: playerState.shouldPlay,
509
+ onLost: function onLost() {
510
+ playerActions.fadeOutAndPause(400);
337
511
  }
338
- }, React.createElement("p", {
339
- dangerouslySetInnerHTML: {
340
- __html: t('pageflow_scrolled.public.sound_disclaimer.help_text')
512
+ });
513
+
514
+ var onPlayerClick = function onPlayerClick() {
515
+ if (isEditable && !isSelected) {
516
+ return;
517
+ }
518
+
519
+ if (playerState.shouldPlay) {
520
+ playerActions.pause();
521
+ } else {
522
+ playerActions.playBlessed();
523
+ }
524
+ };
525
+
526
+ return (
527
+ /*#__PURE__*/
528
+ React.createElement(Figure, {
529
+ caption: configuration.caption
530
+ },
531
+ /*#__PURE__*/
532
+ React.createElement(AudioPlayerControls, {
533
+ audioFile: audioFile,
534
+ defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
535
+ playerState: playerState,
536
+ playerActions: playerActions,
537
+ standAlone: !posterImageFile,
538
+ configuration: configuration,
539
+ sectionProps: sectionProps,
540
+ onPlayerClick: onPlayerClick
541
+ },
542
+ /*#__PURE__*/
543
+ React.createElement(AudioPlayer, {
544
+ load: shouldPrepare ? 'auto' : shouldLoad ? 'poster' : 'none',
545
+ position: configuration.position,
546
+ controls: configuration.controls,
547
+ playerState: playerState,
548
+ playerActions: playerActions,
549
+ audioFile: audioFile,
550
+ posterImageFile: posterImageFile,
551
+ defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
552
+ quality: 'high',
553
+ playsInline: true,
554
+ atmoDuringPlayback: configuration.atmoDuringPlayback
555
+ })))
556
+ );
557
+ }
558
+
559
+ frontend.contentElementTypes.register('inlineAudio', {
560
+ component: InlineAudio,
561
+ lifecycle: true
562
+ });
563
+
564
+ var styles$2 = {"soundDisclaimer":"SoundDisclaimer-module_soundDisclaimer__31hWh","unmute":"SoundDisclaimer-module_unmute__1V4Ab","unmuted":"SoundDisclaimer-module_unmuted__22CJ5","active":"SoundDisclaimer-module_active__11_kc"};
565
+
566
+ function _objectWithoutPropertiesLoose(source, excluded) {
567
+ if (source == null) return {};
568
+ var target = {};
569
+ var sourceKeys = Object.keys(source);
570
+ var key, i;
571
+
572
+ for (i = 0; i < sourceKeys.length; i++) {
573
+ key = sourceKeys[i];
574
+ if (excluded.indexOf(key) >= 0) continue;
575
+ target[key] = source[key];
576
+ }
577
+
578
+ return target;
579
+ }
580
+
581
+ function _objectWithoutProperties(source, excluded) {
582
+ if (source == null) return {};
583
+ var target = _objectWithoutPropertiesLoose(source, excluded);
584
+ var key, i;
585
+
586
+ if (Object.getOwnPropertySymbols) {
587
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
588
+
589
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
590
+ key = sourceSymbolKeys[i];
591
+ if (excluded.indexOf(key) >= 0) continue;
592
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
593
+ target[key] = source[key];
341
594
  }
595
+ }
596
+
597
+ return target;
598
+ }
599
+
600
+ function _extends() {
601
+ _extends = Object.assign || function (target) {
602
+ for (var i = 1; i < arguments.length; i++) {
603
+ var source = arguments[i];
604
+
605
+ for (var key in source) {
606
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
607
+ target[key] = source[key];
608
+ }
609
+ }
610
+ }
611
+
612
+ return target;
613
+ };
614
+
615
+ return _extends.apply(this, arguments);
616
+ }
617
+ var MutedIcon = (function (_ref) {
618
+ var _ref$styles = _ref.styles,
619
+ styles = _ref$styles === void 0 ? {} : _ref$styles,
620
+ props = _objectWithoutProperties(_ref, ["styles"]);
621
+
622
+ return React.createElement("svg", _extends({
623
+ "aria-hidden": "true",
624
+ "data-prefix": "fas",
625
+ "data-icon": "volume-mute",
626
+ className: (styles["svg-inline--fa"] || "svg-inline--fa") + " " + (styles["fa-volume-mute"] || "fa-volume-mute") + " " + (styles["fa-w-16"] || "fa-w-16"),
627
+ xmlns: "http://www.w3.org/2000/svg",
628
+ viewBox: "0 0 512 512"
629
+ }, props), React.createElement("path", {
630
+ d: "M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"
342
631
  }));
632
+ });
633
+
634
+ function _extends$1() {
635
+ _extends$1 = Object.assign || function (target) {
636
+ for (var i = 1; i < arguments.length; i++) {
637
+ var source = arguments[i];
638
+
639
+ for (var key in source) {
640
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
641
+ target[key] = source[key];
642
+ }
643
+ }
644
+ }
645
+
646
+ return target;
647
+ };
648
+
649
+ return _extends$1.apply(this, arguments);
650
+ }
651
+ var UnmutedIcon = (function (_ref) {
652
+ var _ref$styles = _ref.styles,
653
+ styles = _ref$styles === void 0 ? {} : _ref$styles,
654
+ props = _objectWithoutProperties(_ref, ["styles"]);
655
+
656
+ return React.createElement("svg", _extends$1({
657
+ "aria-hidden": "true",
658
+ "data-prefix": "fas",
659
+ "data-icon": "volume-mute",
660
+ className: (styles["svg-inline--fa"] || "svg-inline--fa") + " " + (styles["fa-volume-mute"] || "fa-volume-mute") + " " + (styles["fa-w-16"] || "fa-w-16"),
661
+ xmlns: "http://www.w3.org/2000/svg",
662
+ viewBox: "0 0 512 512"
663
+ }, props), React.createElement("path", {
664
+ d: "M232.36 64.01a24.007 24.007 0 00-1.176.002c-5.703.15-11.464 2.348-16.155 7.039L126.061 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-14.293-11.514-23.733-23.64-24.01zm149.5 31.994c-8.107-.16-16.098 3.814-20.75 11.217-7.09 11.28-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256c0-63.53-32.06-121.94-85.77-156.24a23.808 23.808 0 00-12.37-3.756zm-55.032 80.174c-8.51-.046-16.795 4.42-21.209 12.402-6.39 11.61-2.159 26.2 9.451 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88 0-31.88-17.54-61.32-45.78-76.86a23.987 23.987 0 00-11.402-2.952z"
665
+ }));
666
+ });
667
+
668
+ function SoundDisclaimer() {
669
+ var _useContentElementEdi = useContentElementEditorState(),
670
+ isEditable = _useContentElementEdi.isEditable,
671
+ isSelected = _useContentElementEdi.isSelected;
672
+
673
+ var _useI18n = useI18n(),
674
+ t = _useI18n.t;
675
+
676
+ var muted = useMediaMuted();
677
+ return (
678
+ /*#__PURE__*/
679
+ React.createElement("div", {
680
+ className: classNames(styles$2.soundDisclaimer),
681
+ style: {
682
+ pointerEvents: isEditable && !isSelected ? 'none' : undefined
683
+ }
684
+ },
685
+ /*#__PURE__*/
686
+ React.createElement("button", {
687
+ className: classNames(styles$2.unmute, _defineProperty({}, styles$2.active, muted)),
688
+ onClick: function onClick() {
689
+ return media.mute(false);
690
+ }
691
+ },
692
+ /*#__PURE__*/
693
+ React.createElement(MutedIcon, null),
694
+ /*#__PURE__*/
695
+ React.createElement("p", {
696
+ dangerouslySetInnerHTML: {
697
+ __html: t('pageflow_scrolled.public.sound_disclaimer.help_muted')
698
+ }
699
+ })),
700
+ /*#__PURE__*/
701
+ React.createElement("div", {
702
+ className: classNames(styles$2.unmuted, _defineProperty({}, styles$2.active, !muted))
703
+ },
704
+ /*#__PURE__*/
705
+ React.createElement(UnmutedIcon, null),
706
+ /*#__PURE__*/
707
+ React.createElement("p", {
708
+ dangerouslySetInnerHTML: {
709
+ __html: t('pageflow_scrolled.public.sound_disclaimer.help_unmuted')
710
+ }
711
+ })))
712
+ );
343
713
  }
344
714
 
345
715
  frontend.contentElementTypes.register('soundDisclaimer', {
346
716
  component: SoundDisclaimer
347
717
  });
348
718
 
349
- var css$6 = ".TextBlock-module_text__21Hk4 {\n padding: 0;\n margin: 1em 0;\n text-shadow: none;\n}\n\n.TextBlock-module_dummy__2KicI {\n opacity: 0.7;\n}\n\n.TextBlock-module_text__21Hk4 a {\n color: #fff;\n word-wrap: break-word;\n}\n\n.TextBlock-module_text__21Hk4 ol,\n.TextBlock-module_text__21Hk4 ul {\n padding-left: 20px;\n}\n";
350
- var styles$6 = {"text":"TextBlock-module_text__21Hk4","dummy":"TextBlock-module_dummy__2KicI"};
351
- styleInject(css$6);
719
+ var styles$3 = {"text":"TextBlock-module_text__21Hk4"};
352
720
 
353
- function TextBlock(_ref) {
354
- var configuration = _ref.configuration;
355
- return React.createElement(Text, {
356
- scaleCategory: "body"
357
- }, React.createElement("div", {
358
- className: classNames(styles$6.text, _defineProperty({}, styles$6.dummy, configuration.dummy)),
359
- dangerouslySetInnerHTML: {
360
- __html: configuration.children
361
- }
362
- }));
721
+ function TextBlock(props) {
722
+ var updateConfiguration = useContentElementConfigurationUpdate();
723
+
724
+ var _useI18n = useI18n({
725
+ locale: 'ui'
726
+ }),
727
+ t = _useI18n.t;
728
+
729
+ return (
730
+ /*#__PURE__*/
731
+ React.createElement("div", {
732
+ className: styles$3.text
733
+ },
734
+ /*#__PURE__*/
735
+ React.createElement(EditableText, {
736
+ value: props.configuration.value,
737
+ contentElementId: props.contentElementId,
738
+ placeholder: t('pageflow_scrolled.inline_editing.type_text'),
739
+ onChange: function onChange(value) {
740
+ return updateConfiguration({
741
+ value: value
742
+ });
743
+ }
744
+ }))
745
+ );
363
746
  }
364
747
 
365
748
  frontend.contentElementTypes.register('textBlock', {
366
- component: TextBlock
749
+ component: TextBlock,
750
+ customSelectionRect: true,
751
+ supportsWrappingAroundFloats: true
367
752
  });
368
753
 
369
- var css$7 = ".VideoEmbed-module_VideoEmbed__3BUjc {\n margin-bottom: 15px;\n}\n\n.VideoEmbed-module_embedWrapper__1kG8A {\n overflow:hidden;\n position:relative;\n background: black;\n padding-top: 56.25%;\n}\n\n.VideoEmbed-module_wide__1IwOr {\n padding-top: 56.25%;\n}\n\n.VideoEmbed-module_narrow__2jLxH {\n padding-top: 75%;\n}\n\n.VideoEmbed-module_square__2ljo8 {\n padding-top: 100%;\n}\n\n.VideoEmbed-module_portrait__1ttPj {\n padding-top: 177.77%;\n}\n\n.VideoEmbed-module_embedPlayer__54NKG {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n";
370
- var styles$7 = {"VideoEmbed":"VideoEmbed-module_VideoEmbed__3BUjc","embedWrapper":"VideoEmbed-module_embedWrapper__1kG8A","wide":"VideoEmbed-module_wide__1IwOr","narrow":"VideoEmbed-module_narrow__2jLxH","square":"VideoEmbed-module_square__2ljo8","portrait":"VideoEmbed-module_portrait__1ttPj","embedPlayer":"VideoEmbed-module_embedPlayer__54NKG"};
371
- styleInject(css$7);
754
+ var styles$4 = {"VideoEmbed":"VideoEmbed-module_VideoEmbed__3BUjc","embedPlayer":"VideoEmbed-module_embedPlayer__54NKG"};
372
755
 
756
+ var aspectRatios = {
757
+ wide: 0.5625,
758
+ narrow: 0.75,
759
+ square: 1,
760
+ portrait: 1.7777
761
+ };
373
762
  function VideoEmbed(_ref) {
374
- var configuration = _ref.configuration;
763
+ var contentElementId = _ref.contentElementId,
764
+ configuration = _ref.configuration;
375
765
 
376
- // base64-encoded configuration
377
- // => make component re-render on configuration changes
378
- function keyFromConfiguration(config) {
379
- return btoa(JSON.stringify(config));
380
- }
766
+ var _useContentElementEdi = useContentElementEditorState(),
767
+ isEditable = _useContentElementEdi.isEditable,
768
+ isSelected = _useContentElementEdi.isSelected;
381
769
 
382
- return React.createElement("div", {
383
- className: styles$7.VideoEmbed
384
- }, React.createElement("div", {
385
- className: classNames(styles$7.embedWrapper, styles$7[configuration.aspectRatio])
386
- }, React.createElement(ReactPlayer, {
387
- className: styles$7.embedPlayer,
388
- key: keyFromConfiguration(configuration),
389
- url: configuration.videoSource,
390
- playing: true,
391
- light: true,
392
- width: "100%",
393
- height: "100%",
394
- controls: !configuration.hideControls,
395
- config: {
396
- youtube: {
397
- playerVars: {
398
- showinfo: !configuration.hideInfo
399
- }
400
- },
401
- vimeo: {
402
- playerOptions: {
403
- byline: !configuration.hideInfo
404
- }
770
+ var _useContentElementLif = useContentElementLifecycle(),
771
+ shouldLoad = _useContentElementLif.shouldLoad;
772
+
773
+ var _useState = useState('unplayed'),
774
+ _useState2 = _slicedToArray(_useState, 2),
775
+ playerState = _useState2[0],
776
+ setPlayerState = _useState2[1];
777
+
778
+ return (
779
+ /*#__PURE__*/
780
+ React.createElement("div", {
781
+ className: styles$4.VideoEmbed,
782
+ style: {
783
+ pointerEvents: isEditable && !isSelected ? 'none' : undefined
405
784
  }
785
+ },
786
+ /*#__PURE__*/
787
+ React.createElement(Figure, {
788
+ caption: configuration.caption
789
+ },
790
+ /*#__PURE__*/
791
+ React.createElement(ViewportDependentPillarBoxes, {
792
+ aspectRatio: aspectRatios[configuration.aspectRatio || 'wide'],
793
+ position: configuration.position,
794
+ opaque: !!configuration.caption
795
+ }, shouldLoad &&
796
+ /*#__PURE__*/
797
+ React.createElement(PreparedPlayer, {
798
+ playerState: playerState,
799
+ setPlayerState: setPlayerState,
800
+ contentElementId: contentElementId,
801
+ configuration: configuration
802
+ })),
803
+ /*#__PURE__*/
804
+ React.createElement(ThirdPartyOptOutInfo, {
805
+ providerName: "video",
806
+ hide: playerState === 'playing',
807
+ contentElementPosition: configuration.position
808
+ })))
809
+ );
810
+ }
811
+
812
+ function PreparedPlayer(_ref2) {
813
+ var contentElementId = _ref2.contentElementId,
814
+ configuration = _ref2.configuration,
815
+ playerState = _ref2.playerState,
816
+ setPlayerState = _ref2.setPlayerState;
817
+ useAudioFocus({
818
+ key: contentElementId,
819
+ request: playerState === 'playing',
820
+ onLost: function onLost() {
821
+ setPlayerState('paused');
406
822
  }
407
- })), React.createElement(InlineCaption, {
408
- text: configuration.caption
409
- }));
823
+ }); // React player does not re-create player when controls or config
824
+ // prop changes. Ensure key changes to force React to re-mount
825
+ // component.
826
+
827
+ function keyFromConfiguration(config) {
828
+ return [config.hideControls, config.hideInfo].join('');
829
+ }
830
+
831
+ return (
832
+ /*#__PURE__*/
833
+ React.createElement(ThirdPartyOptIn, {
834
+ providerName: "video"
835
+ }, function (_ref3) {
836
+ var consentedHere = _ref3.consentedHere;
837
+ return (
838
+ /*#__PURE__*/
839
+ React.createElement(ReactPlayer, {
840
+ className: styles$4.embedPlayer,
841
+ key: keyFromConfiguration(configuration),
842
+ url: configuration.videoSource,
843
+ playing: playerState !== 'paused',
844
+ onPlay: function onPlay() {
845
+ return setPlayerState('playing');
846
+ },
847
+ onPause: function onPause() {
848
+ return setPlayerState('paused');
849
+ },
850
+ onEnded: function onEnded() {
851
+ return setPlayerState('paused');
852
+ },
853
+ light: !consentedHere && playerState === 'unplayed',
854
+ width: "100%",
855
+ height: "100%",
856
+ controls: !configuration.hideControls,
857
+ config: {
858
+ youtube: {
859
+ playerVars: {
860
+ showinfo: !configuration.hideInfo
861
+ }
862
+ },
863
+ vimeo: {
864
+ playerOptions: {
865
+ byline: !configuration.hideInfo
866
+ }
867
+ }
868
+ }
869
+ })
870
+ );
871
+ })
872
+ );
410
873
  }
411
874
 
412
875
  frontend.contentElementTypes.register('videoEmbed', {
413
- component: VideoEmbed
876
+ component: VideoEmbed,
877
+ lifecycle: true
414
878
  });
415
879
 
416
- var css$8 = "\n.ExternalLink-module_hidden__3jer0 {\n display: none;\n}\n\n.ExternalLink-module_link_item__Blypv {\n width: 45%;\n max-width: 45%;\n vertical-align: top;\n margin: 2% auto;\n background-color: #fff; \n color: rgba(20,20,20,0.8);\n text-decoration: none;\n transition: 0.3s;\n}\n\n\n.ExternalLink-module_link_item__Blypv.ExternalLink-module_invert__1zrgN {\n background-color: rgba(20,20,20,0.8);;\n color: #fff;\n}\n\n.ExternalLink-module_link_item__Blypv.ExternalLink-module_layout_center__3NRpQ {\n width: 29%;\n max-width: 29%;\n \n}\n\n.ExternalLink-module_link_item__Blypv:hover {\n background-color: #141414;\n color: #fff;\n -webkit-transform: scale(1.05);\n -moz-transform: scale(1.05);\n -ms-transform: scale(1.05);\n -o-transform: scale(1.05);\n transform: scale(1.05);\n}\n\n.ExternalLink-module_link_item__Blypv:hover .ExternalLink-module_link_title__FZJ-0 {\n text-decoration: underline;\n}\n\n.ExternalLink-module_link_thumbnail__2_BHq {\n width: auto;\n background-repeat: no-repeat;\n background-size: cover;\n padding-top: 56.25%;\n position: relative;\n\n}\n\n.ExternalLink-module_link_details__lRhKU {\n margin: 20px;\n}\n\n.ExternalLink-module_link_details__lRhKU > .ExternalLink-module_link_title__FZJ-0 {\n font-size: 1.2em;\n font-weight: bold;\n margin-bottom: 20px;\n}\n\n.ExternalLink-module_link_details__lRhKU > .ExternalLink-module_link_desc__3fSe1 {\n\n}\n\n.ExternalLink-module_link_details__lRhKU > p {\n width: 100%;\n white-space: normal;\n line-height: 1.3em;\n}\n\n.ExternalLink-module_tooltip__18MpC {\n position: absolute;\n left: 50%;\n top: 80px;\n width: 180px;\n padding: 5px;\n margin-left: -95px;\n background-color: #444;\n color: #fff;\n border: solid 1px #fff;\n opacity: 0.9;\n font-size: 13px;\n text-align: center;\n white-space: normal;\n}\n\n.ExternalLink-module_tooltip__18MpC > span {\n display: block;\n color: #fff;\n text-decoration: underline;\n}";
417
- var styles$8 = {"hidden":"ExternalLink-module_hidden__3jer0","link_item":"ExternalLink-module_link_item__Blypv","invert":"ExternalLink-module_invert__1zrgN","layout_center":"ExternalLink-module_layout_center__3NRpQ","link_title":"ExternalLink-module_link_title__FZJ-0","link_thumbnail":"ExternalLink-module_link_thumbnail__2_BHq","link_details":"ExternalLink-module_link_details__lRhKU","link_desc":"ExternalLink-module_link_desc__3fSe1","tooltip":"ExternalLink-module_tooltip__18MpC"};
418
- styleInject(css$8);
880
+ var styles$5 = {"hidden":"ExternalLink-module_hidden__3jer0","link_item":"ExternalLink-module_link_item__Blypv","invert":"ExternalLink-module_invert__1zrgN","layout_center":"ExternalLink-module_layout_center__3NRpQ","link_title":"ExternalLink-module_link_title__FZJ-0","link_thumbnail":"ExternalLink-module_link_thumbnail__2_BHq","link_details":"ExternalLink-module_link_details__lRhKU","link_desc":"ExternalLink-module_link_desc__3fSe1","tooltip":"ExternalLink-module_tooltip__18MpC"};
419
881
 
420
882
  function ExternalLink(props) {
421
- var _classNames;
883
+ var _classNames2;
422
884
 
423
885
  var _useState = useState(true),
424
886
  _useState2 = _slicedToArray(_useState, 2),
425
887
  hideTooltip = _useState2[0],
426
888
  setHideTooltip = _useState2[1];
427
889
 
428
- var _props$sectionProps = props.sectionProps,
429
- layout = _props$sectionProps.layout,
430
- invert = _props$sectionProps.invert;
890
+ var layout = props.sectionProps.layout;
431
891
 
432
- var _useI18n = useI18n(),
892
+ var _useI18n = useI18n({
893
+ locale: 'ui'
894
+ }),
433
895
  t = _useI18n.t;
434
896
 
435
- var isInEditor = function isInEditor() {
436
- return window.frameElement != undefined && window.location.pathname.includes('/editor/entries/');
437
- };
897
+ var _useContentElementEdi = useContentElementEditorState(),
898
+ isEditable = _useContentElementEdi.isEditable,
899
+ isSelected = _useContentElementEdi.isSelected;
438
900
 
439
- var onTooltipClick = function onTooltipClick() {
440
- window.open(props.url, '_blank');
441
- setHideTooltip(true);
442
- };
901
+ var thumbnailImageFile = useFile({
902
+ collectionName: 'imageFiles',
903
+ permaId: props.thumbnail
904
+ });
443
905
 
444
906
  var onClick = function onClick(event) {
445
- if (props.open_in_new_tab == false && isInEditor()) {
446
- setHideTooltip(false);
447
- event.preventDefault();
907
+ if (isEditable) {
908
+ if (!props.open_in_new_tab || !isSelected) {
909
+ event.preventDefault();
910
+ }
911
+
912
+ if (!props.open_in_new_tab && isSelected) {
913
+ setHideTooltip(false);
914
+ }
448
915
  }
449
916
  };
450
917
 
@@ -452,82 +919,251 @@ function ExternalLink(props) {
452
919
  setHideTooltip(true);
453
920
  };
454
921
 
455
- return React.createElement("a", {
456
- className: classNames(styles$8.link_item, (_classNames = {}, _defineProperty(_classNames, styles$8.invert, invert), _defineProperty(_classNames, styles$8.layout_center, layout == 'center'), _classNames)),
457
- href: props.url || '',
458
- onClick: onClick,
459
- onMouseLeave: onMouseLeave,
460
- target: props.open_in_new_tab == '1' ? '_blank' : '_self'
461
- }, React.createElement("div", {
462
- className: styles$8.link_thumbnail
463
- }, React.createElement(Image, {
464
- id: props.thumbnail
465
- })), React.createElement("div", {
466
- className: styles$8.link_details
467
- }, React.createElement("p", {
468
- className: styles$8.link_title
469
- }, props.title), React.createElement("p", {
470
- className: styles$8.link_desc,
471
- dangerouslySetInnerHTML: {
472
- __html: props.description
922
+ function renderNewTabTooltip() {
923
+ if (isEditable) {
924
+ var onTooltipClick = function onTooltipClick() {
925
+ window.open(props.url, '_blank');
926
+ setHideTooltip(true);
927
+ };
928
+
929
+ return (
930
+ /*#__PURE__*/
931
+ React.createElement("div", {
932
+ className: classNames(_defineProperty({}, styles$5.hidden, hideTooltip), styles$5.tooltip),
933
+ onClick: onTooltipClick
934
+ }, t('pageflow_scrolled.inline_editing.external_links.open_in_new_tab_message'),
935
+ /*#__PURE__*/
936
+ React.createElement("span", null, t('pageflow_scrolled.inline_editing.external_links.open_in_new_tab')))
937
+ );
473
938
  }
474
- })), React.createElement("div", {
475
- className: classNames(_defineProperty({}, styles$8.hidden, hideTooltip), styles$8.tooltip),
476
- onClick: onTooltipClick
477
- }, t('pageflow_scrolled.public.external_link.open_in_new_tab_message'), React.createElement("span", {
478
- target: "_blank"
479
- }, t('pageflow_scrolled.public.external_link.open_in_new_tab'))));
939
+ }
940
+
941
+ return (
942
+ /*#__PURE__*/
943
+ React.createElement("a", {
944
+ className: classNames(styles$5.link_item, (_classNames2 = {}, _defineProperty(_classNames2, styles$5.invert, props.invert), _defineProperty(_classNames2, styles$5.layout_center, layout === 'center'), _classNames2)),
945
+ href: props.url || 'about:blank',
946
+ onClick: onClick,
947
+ onMouseLeave: onMouseLeave,
948
+ target: props.open_in_new_tab ? '_blank' : '_self',
949
+ rel: props.open_in_new_tab ? 'noopen noreferrer' : undefined
950
+ },
951
+ /*#__PURE__*/
952
+ React.createElement("div", {
953
+ className: styles$5.link_thumbnail
954
+ },
955
+ /*#__PURE__*/
956
+ React.createElement(Image, {
957
+ imageFile: thumbnailImageFile,
958
+ load: props.loadImages,
959
+ variant: "linkThumbnailLarge"
960
+ })),
961
+ /*#__PURE__*/
962
+ React.createElement("div", {
963
+ className: styles$5.link_details
964
+ },
965
+ /*#__PURE__*/
966
+ React.createElement("p", {
967
+ className: styles$5.link_title
968
+ }, props.title),
969
+ /*#__PURE__*/
970
+ React.createElement("p", {
971
+ className: styles$5.link_desc
972
+ }, props.description)), renderNewTabTooltip())
973
+ );
480
974
  }
481
975
 
482
- var css$9 = ".ExternalLinkList-module_ext_links_container__16IIo{\n display: flex;\n flex-wrap: wrap;\n border-collapse: separate;\n border-spacing: 10px;\n min-height: 240px;\n width: auto;\n height: auto;\n pointer-events: all;\n position: relative;\n -webkit-transition: opacity 0.5s;\n -moz-transition: opacity 0.5s;\n transition: opacity 0.5s;\n transition-timing-function: cubic-bezier(0.1, 0.57, 0.1, 1);\n transition-duration: 0ms;\n}\n";
483
- var styles$9 = {"ext_links_container":"ExternalLinkList-module_ext_links_container__16IIo"};
484
- styleInject(css$9);
976
+ var styles$6 = {"ext_links_container":"ExternalLinkList-module_ext_links_container__16IIo"};
485
977
 
486
978
  function ExternalLinkList(props) {
487
979
  var linkList = props.configuration.links || [];
488
- return React.createElement("div", {
489
- className: styles$9.ext_links_container
490
- }, linkList.map(function (link, index) {
491
- return React.createElement(ExternalLink, Object.assign({}, link, {
492
- key: link.id,
493
- sectionProps: props.sectionProps
494
- }));
495
- }));
980
+
981
+ var _useContentElementLif = useContentElementLifecycle(),
982
+ shouldLoad = _useContentElementLif.shouldLoad;
983
+
984
+ var darkBackground = useDarkBackground();
985
+ return (
986
+ /*#__PURE__*/
987
+ React.createElement("div", {
988
+ className: styles$6.ext_links_container
989
+ }, linkList.map(function (link, index) {
990
+ return (
991
+ /*#__PURE__*/
992
+ React.createElement(ExternalLink, Object.assign({}, link, {
993
+ key: link.id,
994
+ invert: !darkBackground,
995
+ sectionProps: props.sectionProps,
996
+ loadImages: shouldLoad
997
+ }))
998
+ );
999
+ }))
1000
+ );
496
1001
  }
497
1002
 
498
1003
  frontend.contentElementTypes.register('externalLinkList', {
499
- component: ExternalLinkList
1004
+ component: ExternalLinkList,
1005
+ lifecycle: true
500
1006
  });
501
1007
 
502
- var css$a = ".DataWrapperChart-module_container__2eZ15 {\n min-height: 200px;\n height: 400px;\n}\n\n.DataWrapperChart-module_container__2eZ15 > iframe {\n width: 100%;\n height: 100%;\n position: relative;\n top: 0;\n}";
503
- var styles$a = {"container":"DataWrapperChart-module_container__2eZ15"};
504
- styleInject(css$a);
1008
+ function useIframeHeight(url) {
1009
+ var _useState = useState('400px'),
1010
+ _useState2 = _slicedToArray(_useState, 2),
1011
+ height = _useState2[0],
1012
+ setHeight = _useState2[1];
1013
+
1014
+ useEffect(function () {
1015
+ window.addEventListener('message', receive);
1016
+
1017
+ function receive(event) {
1018
+ if (typeof event.data['datawrapper-height'] !== 'undefined') {
1019
+ for (var chartId in event.data['datawrapper-height']) {
1020
+ if ((url === null || url === void 0 ? void 0 : url.indexOf(chartId)) > -1) {
1021
+ setHeight(event.data['datawrapper-height'][chartId] + 'px');
1022
+ }
1023
+ }
1024
+ }
1025
+ }
1026
+
1027
+ return function () {
1028
+ return window.removeEventListener('message', receive);
1029
+ };
1030
+ }, [url]);
1031
+ return height;
1032
+ }
1033
+
1034
+ var styles$7 = {"container":"DataWrapperChart-module_container__2eZ15"};
505
1035
 
506
1036
  function DataWrapperChart(_ref) {
507
1037
  var configuration = _ref.configuration;
508
- var ref = useRef();
509
- var onScreen = useOnScreen(ref, '25% 0px 25% 0px'); // remove url protocol, so that it is selected by the browser itself
1038
+
1039
+ var _useI18n = useI18n(),
1040
+ t = _useI18n.t;
1041
+
1042
+ var _useContentElementLif = useContentElementLifecycle(),
1043
+ shouldLoad = _useContentElementLif.shouldLoad;
1044
+
1045
+ var _useContentElementEdi = useContentElementEditorState(),
1046
+ isEditable = _useContentElementEdi.isEditable,
1047
+ isSelected = _useContentElementEdi.isSelected;
1048
+
1049
+ var height = useIframeHeight(configuration.url); // remove url protocol, so that it is selected by the browser itself
510
1050
 
511
1051
  var srcURL = '';
512
1052
 
513
- if (configuration.url && onScreen) {
1053
+ if (configuration.url) {
514
1054
  srcURL = configuration.url.replace(/http(s|):/, '');
515
1055
  }
516
1056
 
517
- return React.createElement("div", {
518
- ref: ref,
519
- className: styles$a.container
520
- }, React.createElement("iframe", {
521
- src: srcURL,
522
- scrolling: "auto",
523
- frameBorder: "0",
524
- align: "aus",
525
- allowFullScreen: true,
526
- mozallowfullscreen: "true",
527
- webkitallowfullscreen: "true"
528
- }));
1057
+ var backgroundColor = configuration.backgroundColor || '#323d4d';
1058
+ return (
1059
+ /*#__PURE__*/
1060
+ React.createElement(Figure, {
1061
+ caption: configuration.caption
1062
+ },
1063
+ /*#__PURE__*/
1064
+ React.createElement("div", {
1065
+ className: styles$7.container,
1066
+ style: {
1067
+ pointerEvents: isEditable && !isSelected ? 'none' : undefined,
1068
+ backgroundColor: backgroundColor,
1069
+ color: textColorForBackgroundColor(backgroundColor),
1070
+ height: height
1071
+ },
1072
+ "data-percy": "hide"
1073
+ },
1074
+ /*#__PURE__*/
1075
+ React.createElement(ThirdPartyOptIn, {
1076
+ providerName: "datawrapper"
1077
+ }, shouldLoad && renderIframe(srcURL, configuration.title || t('pageflow_scrolled.public.chart.default_title')),
1078
+ /*#__PURE__*/
1079
+ React.createElement(ThirdPartyOptOutInfo, {
1080
+ providerName: "datawrapper",
1081
+ contentElementPosition: configuration.position
1082
+ }))))
1083
+ );
1084
+ }
1085
+
1086
+ function renderIframe(url, title) {
1087
+ if (!url) {
1088
+ return null;
1089
+ }
1090
+
1091
+ return (
1092
+ /*#__PURE__*/
1093
+ React.createElement("iframe", {
1094
+ src: url,
1095
+ title: title,
1096
+ scrolling: "no",
1097
+ allowFullScreen: true,
1098
+ mozallowfullscreen: "true",
1099
+ webkitallowfullscreen: "true"
1100
+ })
1101
+ );
529
1102
  }
530
1103
 
531
1104
  frontend.contentElementTypes.register('dataWrapperChart', {
532
- component: DataWrapperChart
1105
+ component: DataWrapperChart,
1106
+ lifecycle: true
1107
+ });
1108
+
1109
+ function VrImage(_ref) {
1110
+ var configuration = _ref.configuration;
1111
+
1112
+ var _useContentElementLif = useContentElementLifecycle({
1113
+ onActivate: function onActivate() {
1114
+ if (viewerRef.current) {
1115
+ viewerRef.current.lookAt({
1116
+ yaw: viewerRef.current.getYaw() + 20
1117
+ }, 1000);
1118
+ }
1119
+ }
1120
+ }),
1121
+ shouldLoad = _useContentElementLif.shouldLoad;
1122
+
1123
+ var _useContentElementEdi = useContentElementEditorState(),
1124
+ isEditable = _useContentElementEdi.isEditable,
1125
+ isSelected = _useContentElementEdi.isSelected;
1126
+
1127
+ var viewerRef = useRef();
1128
+ var imageFile = useFile({
1129
+ collectionName: 'imageFiles',
1130
+ permaId: configuration.image
1131
+ });
1132
+ return (
1133
+ /*#__PURE__*/
1134
+ React.createElement("div", {
1135
+ style: {
1136
+ pointerEvents: isEditable && !isSelected ? 'none' : undefined
1137
+ }
1138
+ },
1139
+ /*#__PURE__*/
1140
+ React.createElement(Figure, {
1141
+ caption: configuration.caption
1142
+ },
1143
+ /*#__PURE__*/
1144
+ React.createElement(ViewportDependentPillarBoxes, {
1145
+ aspectRatio: configuration.position === 'full' ? 0.5 : 0.75,
1146
+ position: configuration.position,
1147
+ opaque: !!configuration.caption
1148
+ }, renderLazyPanorama(configuration, imageFile, shouldLoad, viewerRef))))
1149
+ );
1150
+ }
1151
+
1152
+ function renderLazyPanorama(configuration, imageFile, shouldLoad, viewerRef) {
1153
+ if (shouldLoad && imageFile && imageFile.isReady) {
1154
+ return (
1155
+ /*#__PURE__*/
1156
+ React.createElement(Panorama, {
1157
+ imageFile: imageFile,
1158
+ initialYaw: configuration.initialYaw,
1159
+ initialPitch: configuration.initialPitch,
1160
+ viewerRef: viewerRef
1161
+ })
1162
+ );
1163
+ }
1164
+ }
1165
+
1166
+ frontend.contentElementTypes.register('vrImage', {
1167
+ component: VrImage,
1168
+ lifecycle: true
533
1169
  });