pageflow 15.6.1 → 15.7.0

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 (267) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +236 -11
  3. data/README.md +1 -2
  4. data/admins/pageflow/entry.rb +28 -57
  5. data/admins/pageflow/user.rb +1 -3
  6. data/app/assets/images/pageflow/admin/icons/buttons/editor.svg +2 -0
  7. data/app/assets/images/pageflow/admin/icons/buttons/preview.svg +2 -0
  8. data/app/assets/images/pageflow/admin/icons/buttons/show_public.svg +2 -0
  9. data/app/assets/images/pageflow/admin/icons/delete.svg +9 -0
  10. data/app/assets/images/pageflow/admin/icons/done.svg +6 -0
  11. data/app/assets/images/pageflow/admin/icons/edit.svg +7 -0
  12. data/app/assets/images/pageflow/admin/icons/editor.svg +2 -0
  13. data/app/assets/images/pageflow/admin/icons/folder.svg +8 -0
  14. data/app/assets/images/pageflow/admin/icons/folder_active.svg +8 -0
  15. data/app/assets/images/pageflow/admin/icons/info.svg +3 -0
  16. data/app/assets/images/pageflow/admin/icons/new.svg +5 -0
  17. data/app/assets/images/pageflow/admin/icons/preview.svg +2 -0
  18. data/app/assets/images/pageflow/admin/icons/published.svg +2 -0
  19. data/app/assets/images/pageflow/admin/icons/published_with_password.svg +2 -0
  20. data/app/assets/images/pageflow/admin/icons/show_public.svg +2 -0
  21. data/app/assets/images/pageflow/editor/blank_entry/logo.png +0 -0
  22. data/app/assets/images/pageflow/themes/default/embed_opt_in.svg +3 -0
  23. data/app/assets/images/pageflow/themes/default/embed_opt_out_info.svg +16 -0
  24. data/app/assets/javascripts/pageflow/admin/entries.js +9 -57
  25. data/app/assets/javascripts/pageflow/dist/ui.js +127 -10
  26. data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +18 -16
  27. data/app/assets/stylesheets/pageflow/admin/badge_list.scss +25 -35
  28. data/app/assets/stylesheets/pageflow/admin/columns.scss +13 -11
  29. data/app/assets/stylesheets/pageflow/admin/embed_code.scss +1 -4
  30. data/app/assets/stylesheets/pageflow/admin/entries/folders.scss +44 -19
  31. data/app/assets/stylesheets/pageflow/admin/entries.scss +15 -31
  32. data/app/assets/stylesheets/pageflow/admin/features.scss +3 -1
  33. data/app/assets/stylesheets/pageflow/admin/forms.scss +14 -12
  34. data/app/assets/stylesheets/pageflow/admin/hint.scss +8 -14
  35. data/app/assets/stylesheets/pageflow/admin/icon_button.scss +25 -14
  36. data/app/assets/stylesheets/pageflow/admin/icon_link.scss +31 -15
  37. data/app/assets/stylesheets/pageflow/admin/publication_state_indicator.scss +14 -7
  38. data/app/assets/stylesheets/pageflow/admin/status_tags.scss +5 -4
  39. data/app/assets/stylesheets/pageflow/admin/tabs_view.scss +36 -34
  40. data/app/assets/stylesheets/pageflow/admin/tooltip_bubble.scss +15 -11
  41. data/app/assets/stylesheets/pageflow/admin.scss +12 -0
  42. data/app/assets/stylesheets/pageflow/editor/background_positioning.scss +15 -61
  43. data/app/assets/stylesheets/pageflow/editor/base.scss +28 -13
  44. data/app/assets/stylesheets/pageflow/editor/blank_entry.scss +6 -6
  45. data/app/assets/stylesheets/pageflow/editor/change_theme.scss +28 -71
  46. data/app/assets/stylesheets/pageflow/editor/composables.scss +2 -2
  47. data/app/assets/stylesheets/pageflow/editor/confirm_encoding.scss +18 -36
  48. data/app/assets/stylesheets/pageflow/editor/confirm_upload.scss +12 -39
  49. data/app/assets/stylesheets/pageflow/editor/dialogs.scss +39 -12
  50. data/app/assets/stylesheets/pageflow/editor/disabled_atmo_indicator.scss +3 -3
  51. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +7 -10
  52. data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +3 -8
  53. data/app/assets/stylesheets/pageflow/editor/failures.scss +3 -3
  54. data/app/assets/stylesheets/pageflow/editor/file_import.scss +22 -38
  55. data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +3 -7
  56. data/app/assets/stylesheets/pageflow/editor/file_settings_dialog.scss +4 -24
  57. data/app/assets/stylesheets/pageflow/editor/file_stages.scss +10 -11
  58. data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -8
  59. data/app/assets/stylesheets/pageflow/editor/files.scss +7 -6
  60. data/app/assets/stylesheets/pageflow/editor/files_explorer.scss +13 -30
  61. data/app/assets/stylesheets/pageflow/editor/files_gallery.scss +15 -11
  62. data/app/assets/stylesheets/pageflow/editor/filtered_files.scss +6 -7
  63. data/app/assets/stylesheets/pageflow/editor/help.scss +19 -14
  64. data/app/assets/stylesheets/pageflow/editor/help_image.scss +1 -1
  65. data/app/assets/stylesheets/pageflow/editor/info_box.scss +19 -0
  66. data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +7 -11
  67. data/app/assets/stylesheets/pageflow/editor/inputs/file_processing_state_display.scss +0 -2
  68. data/app/assets/stylesheets/pageflow/editor/inputs/reference.scss +7 -11
  69. data/app/assets/stylesheets/pageflow/editor/list.scss +13 -10
  70. data/app/assets/stylesheets/pageflow/editor/loading.scss +1 -1
  71. data/app/assets/stylesheets/pageflow/editor/locked.scss +9 -5
  72. data/app/assets/stylesheets/pageflow/editor/menu.scss +5 -5
  73. data/app/assets/stylesheets/pageflow/editor/notifications.scss +15 -14
  74. data/app/assets/stylesheets/pageflow/editor/other_entry_item.scss +7 -3
  75. data/app/assets/stylesheets/pageflow/editor/outline.scss +57 -19
  76. data/app/assets/stylesheets/pageflow/editor/page_links.scss +10 -8
  77. data/app/assets/stylesheets/pageflow/editor/page_selection.scss +2 -29
  78. data/app/assets/stylesheets/pageflow/editor/publish_entry.scss +5 -6
  79. data/app/assets/stylesheets/pageflow/editor/quotas.scss +2 -3
  80. data/app/assets/stylesheets/pageflow/editor/select_button.scss +12 -6
  81. data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -5
  82. data/app/assets/stylesheets/pageflow/editor/storyline_picker.scss +6 -2
  83. data/app/assets/stylesheets/pageflow/editor/text_tracks.scss +6 -22
  84. data/app/assets/stylesheets/pageflow/editor/widgets.scss +2 -2
  85. data/app/assets/stylesheets/pageflow/editor/wysihtml5.scss +35 -29
  86. data/app/assets/stylesheets/pageflow/mixins/background_icons.scss +3 -3
  87. data/app/assets/stylesheets/pageflow/mixins/buttons.scss +50 -68
  88. data/app/assets/stylesheets/pageflow/themes/default/base.scss +2 -0
  89. data/app/assets/stylesheets/pageflow/themes/default/consent/bar.scss +156 -0
  90. data/app/assets/stylesheets/pageflow/themes/default/consent/vendor_list.scss +62 -0
  91. data/app/assets/stylesheets/pageflow/themes/default/consent.scss +2 -0
  92. data/app/assets/stylesheets/pageflow/themes/default/logo/alignment.scss +7 -0
  93. data/app/assets/stylesheets/pageflow/themes/default/page/shadow.scss +44 -0
  94. data/app/assets/stylesheets/pageflow/themes/default/third_party_embed_consent.scss +103 -0
  95. data/app/assets/stylesheets/pageflow/ui/forms.scss +79 -84
  96. data/app/assets/stylesheets/pageflow/ui/functions.scss +56 -0
  97. data/app/assets/stylesheets/pageflow/ui/input/check_box_group_input.scss +2 -3
  98. data/app/assets/stylesheets/pageflow/ui/input/color_input.scss +6 -6
  99. data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +63 -50
  100. data/app/assets/stylesheets/pageflow/ui/normalize/forms.scss +153 -0
  101. data/app/assets/stylesheets/pageflow/ui/normalize.scss +278 -0
  102. data/app/assets/stylesheets/pageflow/ui/properties.scss +44 -0
  103. data/app/assets/stylesheets/pageflow/ui/table_cells/delete_row_table_cell.scss +1 -1
  104. data/app/assets/stylesheets/pageflow/ui/table_view.scss +14 -18
  105. data/app/assets/stylesheets/pageflow/ui/tabs_view.scss +8 -11
  106. data/app/assets/stylesheets/pageflow/ui/tooltip.scss +6 -8
  107. data/app/assets/stylesheets/pageflow/ui/validation_error_messages.scss +6 -0
  108. data/app/assets/stylesheets/pageflow/ui.scss +4 -0
  109. data/app/controllers/pageflow/edit_locks_controller.rb +3 -1
  110. data/app/helpers/pageflow/admin/entries_helper.rb +2 -12
  111. data/app/helpers/pageflow/embed_code_helper.rb +1 -1
  112. data/app/helpers/pageflow/entries_helper.rb +41 -2
  113. data/app/helpers/pageflow/file_background_images_helper.rb +1 -1
  114. data/app/helpers/pageflow/page_types_helper.rb +1 -1
  115. data/app/helpers/pageflow/themes_helper.rb +1 -1
  116. data/app/jobs/pageflow/poll_meta_data_from_zencoder_job.rb +1 -1
  117. data/app/jobs/pageflow/poll_zencoder_job.rb +1 -9
  118. data/app/models/pageflow/audio_file.rb +17 -0
  119. data/app/models/pageflow/audio_file_url_templates.rb +4 -1
  120. data/app/models/pageflow/customized_theme.rb +37 -0
  121. data/app/models/pageflow/draft_entry.rb +6 -59
  122. data/app/models/pageflow/entry_at_revision.rb +68 -0
  123. data/app/models/pageflow/entry_role_query.rb +44 -24
  124. data/app/models/pageflow/image_file_css_background_image_urls.rb +8 -2
  125. data/app/models/pageflow/published_entry.rb +9 -56
  126. data/app/models/pageflow/theme_customization.rb +46 -0
  127. data/app/models/pageflow/theme_customization_file.rb +58 -0
  128. data/app/models/pageflow/video_file.rb +11 -1
  129. data/app/models/pageflow/video_file_url_templates.rb +1 -0
  130. data/app/policies/pageflow/entry_policy.rb +4 -0
  131. data/app/state_machines/pageflow/media_encoding_state_machine.rb +23 -4
  132. data/app/views/admin/entries/_form.html.erb +50 -0
  133. data/app/views/admin/entries/entry_type_name_input.html.erb +5 -0
  134. data/app/views/admin/features/_form.html.erb +1 -1
  135. data/app/views/admin/memberships/_form.html.erb +2 -3
  136. data/app/views/admin/users/_form.html.erb +1 -1
  137. data/app/views/admin/users/invitation.html.erb +2 -2
  138. data/app/views/components/pageflow/admin/entry_user_badge_list.rb +10 -9
  139. data/app/views/components/pageflow/admin/members_tab.rb +5 -1
  140. data/app/views/components/pageflow/admin/revisions_tab.rb +13 -3
  141. data/app/views/components/pageflow/admin/timestamp.rb +20 -0
  142. data/app/views/components/pageflow/admin/user_account_badge_list.rb +5 -6
  143. data/app/views/pageflow/admin/entries/_cannot_add_user.html.erb +9 -5
  144. data/app/views/pageflow/admin/entries/_entry_type_name_input.html.erb +7 -0
  145. data/app/views/pageflow/audio_files/_audio_file.json.jbuilder +13 -0
  146. data/app/views/pageflow/editor/encoding_confirmations/_intro.html.erb +0 -0
  147. data/app/views/pageflow/editor/encoding_confirmations/check.json.jbuilder +14 -2
  148. data/config/initializers/paperclip.rb +16 -1
  149. data/config/locales/de.yml +24 -28
  150. data/config/locales/en.yml +19 -10
  151. data/db/migrate/20210528073122_create_pageflow_theme_customizations.rb +11 -0
  152. data/db/migrate/20210531090654_create_pageflow_theme_customization_files.rb +15 -0
  153. data/db/migrate/20210531102228_add_selected_file_ids_to_theme_customizations.rb +5 -0
  154. data/db/migrate/20211020085902_add_canonical_entry_url_prefix_to_themings.rb +5 -0
  155. data/db/migrate/20220503150010_add_peak_data_to_audio_files.rb +5 -0
  156. data/db/migrate/20220705084830_add_trailing_slash_in_canonical_urls_to_themings.rb +5 -0
  157. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +256 -124
  158. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +566 -167
  159. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +5 -5
  160. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +4 -4
  161. data/entry_types/paged/app/helpers/pageflow_paged/third_party_embed_consent_helper.rb +38 -0
  162. data/entry_types/paged/app/views/pageflow_paged/third_party_embed_consent/_opt_in.html.erb +12 -0
  163. data/entry_types/paged/app/views/pageflow_paged/third_party_embed_consent/_opt_out_info.html.erb +10 -0
  164. data/entry_types/paged/config/initializers/features.rb +2 -0
  165. data/entry_types/paged/config/locales/new/video_contain.de.yml +7 -0
  166. data/entry_types/paged/config/locales/new/video_contain.en.yml +7 -0
  167. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +3 -0
  168. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +1 -0
  169. data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +58 -0
  170. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +37 -3
  171. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +92 -6
  172. data/entry_types/scrolled/app/helpers/pageflow_scrolled/webpack_public_path_helper.rb +20 -0
  173. data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +7 -0
  174. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +5 -2
  175. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +5 -1
  176. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +5 -4
  177. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +16 -0
  178. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +13 -2
  179. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_widget.json.jbuilder +2 -0
  180. data/entry_types/scrolled/config/locales/de.yml +1 -8
  181. data/entry_types/scrolled/config/locales/en.yml +1 -9
  182. data/entry_types/scrolled/config/locales/new/before_after_slider.de.yml +8 -0
  183. data/entry_types/scrolled/config/locales/new/before_after_slider.en.yml +8 -0
  184. data/entry_types/scrolled/config/locales/new/center_ragged.de.yml +8 -0
  185. data/entry_types/scrolled/config/locales/new/center_ragged.en.yml +9 -0
  186. data/entry_types/scrolled/config/locales/new/consent.de.yml +25 -0
  187. data/entry_types/scrolled/config/locales/new/consent.en.yml +24 -0
  188. data/entry_types/scrolled/config/locales/new/content_element_categories.de.yml +39 -0
  189. data/entry_types/scrolled/config/locales/new/content_element_categories.en.yml +39 -0
  190. data/entry_types/scrolled/config/locales/new/default_transition.de.yml +14 -0
  191. data/entry_types/scrolled/config/locales/new/default_transition.en.yml +14 -0
  192. data/entry_types/scrolled/config/locales/new/header_line_breaks.de.yml +28 -0
  193. data/entry_types/scrolled/config/locales/new/header_line_breaks.en.yml +27 -0
  194. data/entry_types/scrolled/config/locales/new/header_size.de.yml +17 -0
  195. data/entry_types/scrolled/config/locales/new/header_size.en.yml +17 -0
  196. data/entry_types/scrolled/config/locales/new/iframe_embed.de.yml +39 -0
  197. data/entry_types/scrolled/config/locales/new/iframe_embed.en.yml +39 -0
  198. data/entry_types/scrolled/config/locales/new/inline_loops.de.yml +26 -0
  199. data/entry_types/scrolled/config/locales/new/inline_loops.en.yml +26 -0
  200. data/entry_types/scrolled/config/locales/new/portrait_inline_image.de.yml +9 -0
  201. data/entry_types/scrolled/config/locales/new/portrait_inline_image.en.yml +9 -0
  202. data/entry_types/scrolled/config/locales/new/section_width.de.yml +10 -0
  203. data/entry_types/scrolled/config/locales/new/section_width.en.yml +10 -0
  204. data/entry_types/scrolled/config/locales/new/typography_variants.de.yml +7 -0
  205. data/entry_types/scrolled/config/locales/new/typography_variants.en.yml +7 -0
  206. data/entry_types/scrolled/config/locales/new/video_embed_poster.de.yml +8 -0
  207. data/entry_types/scrolled/config/locales/new/video_embed_poster.en.yml +8 -0
  208. data/entry_types/scrolled/config/locales/new/waveform_styles.de.yml +11 -0
  209. data/entry_types/scrolled/config/locales/new/waveform_styles.en.yml +12 -0
  210. data/entry_types/scrolled/config/locales/new/widgets.de.yml +6 -0
  211. data/entry_types/scrolled/config/locales/new/widgets.en.yml +6 -0
  212. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +29 -5
  213. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +8 -6
  214. data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +37 -0
  215. data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +57 -0
  216. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +49 -0
  217. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +8 -0
  218. data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +42 -0
  219. data/entry_types/scrolled/lib/pageflow_scrolled.rb +17 -1
  220. data/entry_types/scrolled/package/contentElements-editor.js +323 -89
  221. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  222. data/entry_types/scrolled/package/contentElements-frontend.js +719 -529
  223. data/entry_types/scrolled/package/editor.js +459 -261
  224. data/entry_types/scrolled/package/frontend/{EditableText-7093fd0e.js → EditableInlineText.module-b9923660.js} +284 -362
  225. data/entry_types/scrolled/package/frontend/{i18n-4dc6c377.js → PhonePlatformContext-9fb97827.js} +199 -106
  226. data/entry_types/scrolled/package/frontend/{Viewer-e49e7807.js → Viewer-e2290ea0.js} +196 -79
  227. data/entry_types/scrolled/package/frontend/{Wavesurfer-0adf5667.js → Wavesurfer-7d9cf1b7.js} +16 -58
  228. data/entry_types/scrolled/package/frontend/{components-6a6793ca.js → components-6ab26015.js} +664 -671
  229. data/entry_types/scrolled/package/frontend/{getPrototypeOf-63c7c8e8.js → createSuper-d0f30da3.js} +34 -5
  230. data/entry_types/scrolled/package/frontend/index.css +1 -9
  231. data/entry_types/scrolled/package/frontend/index.js +1919 -2386
  232. data/entry_types/scrolled/package/frontend/{useBrowserFeature-91a4c29d.js → usePhonePlatform-2857c22b.js} +9 -8
  233. data/entry_types/scrolled/package/frontend-server.js +3 -6
  234. data/entry_types/scrolled/package/package.json +16 -8
  235. data/entry_types/scrolled/package/testHelpers.js +456 -0
  236. data/entry_types/scrolled/package/values/breakpoints.module.css +9 -0
  237. data/entry_types/scrolled/package/values/colors.module.css +5 -0
  238. data/entry_types/scrolled/package/widgets/defaultNavigation.css +9 -0
  239. data/entry_types/scrolled/package/widgets/defaultNavigation.js +612 -0
  240. data/entry_types/scrolled/spec/fixtures/image.svg +1 -0
  241. data/lib/pageflow/ability_mixin.rb +4 -0
  242. data/lib/pageflow/built_in_widget_type.rb +4 -0
  243. data/lib/pageflow/built_in_widget_types_plugin.rb +7 -0
  244. data/lib/pageflow/configuration.rb +34 -1
  245. data/lib/pageflow/entry_type.rb +11 -2
  246. data/lib/pageflow/entry_type_configuration.rb +2 -0
  247. data/lib/pageflow/file_type.rb +24 -0
  248. data/lib/pageflow/paperclip_processors/audio_waveform.rb +42 -0
  249. data/lib/pageflow/paperclip_processors/noop.rb +10 -0
  250. data/lib/pageflow/theme_customizations.rb +61 -0
  251. data/lib/pageflow/version.rb +1 -1
  252. data/lib/pageflow.rb +9 -0
  253. data/package/config/jest/index.js +2 -1
  254. data/package/config/postcss/scaleFunctions.js +71 -0
  255. data/package/editor.js +95 -85
  256. data/package/frontend.js +521 -161
  257. data/package/package.json +5 -3
  258. data/package/testHelpers.js +26 -5
  259. data/package/ui.js +124 -11
  260. data/spec/factories/draft_entries.rb +19 -1
  261. data/spec/factories/entries.rb +4 -0
  262. data/spec/factories/published_entries.rb +6 -0
  263. data/spec/fixtures/audio.ogg +0 -0
  264. metadata +118 -14
  265. data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +0 -2
  266. data/app/views/admin/entries/entry_types.json.jbuilder +0 -4
  267. data/package/config/jest/transformers/upwardBabel.js +0 -5
@@ -1,9 +1,9 @@
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';
1
+ import { useContentElementConfigurationUpdate, useI18n, useIsStaticPreview, withShadowClassName, Text, EditableInlineText, frontend, useFile, useContentElementEditorState, FitViewport, ContentElementBox, Figure, useContentElementLifecycle, usePortraitOrientation, Image, usePlayerState, MediaInteractionTracking, useAudioFocus, VideoPlayerControls, VideoPlayer, AudioPlayerControls, AudioPlayer, useMediaMuted, EditableText, ThirdPartyOptOutInfo, ThirdPartyOptIn, useDarkBackground, textColorForBackgroundColor, Panorama, utils } from 'pageflow-scrolled/frontend';
2
+ import React, { useState, useEffect, useRef, useCallback } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import ReactCompareImage from 'react-compare-image';
5
5
  import Measure from 'react-measure';
6
- import { media } from 'pageflow/frontend';
6
+ import { media, documentHiddenState, features } from 'pageflow/frontend';
7
7
  import ReactPlayer from 'react-player';
8
8
 
9
9
  function _defineProperty(obj, key, value) {
@@ -21,7 +21,7 @@ function _defineProperty(obj, key, value) {
21
21
  return obj;
22
22
  }
23
23
 
24
- var styles = {"root":"Heading-module_root__33TFw","right":"Heading-module_right__1TJKF","center":"Heading-module_center__38lDY","first":"Heading-module_first__1PMJX"};
24
+ var styles = {"root":"Heading-module_root__33TFw","right":"Heading-module_right__1TJKF","centerRagged":"Heading-module_centerRagged__388sq","center":"Heading-module_center__38lDY","first":"Heading-module_first__1PMJX"};
25
25
 
26
26
  function Heading(_ref) {
27
27
  var configuration = _ref.configuration,
@@ -35,69 +35,49 @@ function Heading(_ref) {
35
35
  }),
36
36
  t = _useI18n.t;
37
37
 
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
- );
38
+ var isStaticPreview = useIsStaticPreview();
39
+ var legacyValue = configuration.children; // Prevent collision with legacy editor rules for h2 elements. We do
40
+ // not care about header structure in the static preview thumbnails.
41
+
42
+ var Tag = firstSectionInEntry || isStaticPreview ? 'h1' : 'h2';
43
+ return /*#__PURE__*/React.createElement(Tag, {
44
+ className: classNames(styles.root, configuration.typographyVariant && "typography-heading-".concat(configuration.typographyVariant), _defineProperty({}, styles.first, firstSectionInEntry), _defineProperty({}, styles[sectionProps.layout], configuration.position === 'wide' || sectionProps.layout === 'centerRagged'), _defineProperty({}, withShadowClassName, !sectionProps.invert))
45
+ }, /*#__PURE__*/React.createElement(Text, {
46
+ scaleCategory: getScaleCategory(configuration, firstSectionInEntry),
47
+ inline: true
48
+ }, /*#__PURE__*/React.createElement(EditableInlineText, {
49
+ value: configuration.value,
50
+ defaultValue: legacyValue,
51
+ hyphens: configuration.hyphens,
52
+ placeholder: firstSectionInEntry ? t('pageflow_scrolled.inline_editing.type_title') : t('pageflow_scrolled.inline_editing.type_heading'),
53
+ onChange: function onChange(value) {
54
+ return updateConfiguration({
55
+ value: value
56
+ });
57
+ }
58
+ })));
61
59
  }
62
60
 
63
- frontend.contentElementTypes.register('heading', {
64
- component: Heading
65
- });
61
+ function getScaleCategory(configuration, firstSectionInEntry) {
62
+ switch (configuration.textSize) {
63
+ case 'large':
64
+ return 'heading-lg';
66
65
 
67
- function ownKeys(object, enumerableOnly) {
68
- var keys = Object.keys(object);
66
+ case 'medium':
67
+ return 'heading-md';
69
68
 
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);
76
- }
77
-
78
- return keys;
79
- }
80
-
81
- function _objectSpread2(target) {
82
- for (var i = 1; i < arguments.length; i++) {
83
- var source = arguments[i] != null ? arguments[i] : {};
69
+ case 'small':
70
+ return 'heading-sm';
84
71
 
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
- }
72
+ default:
73
+ return firstSectionInEntry ? 'heading-lg' : 'heading-sm';
96
74
  }
97
-
98
- return target;
99
75
  }
100
76
 
77
+ frontend.contentElementTypes.register('heading', {
78
+ component: Heading
79
+ });
80
+
101
81
  function _arrayWithHoles(arr) {
102
82
  if (Array.isArray(arr)) return arr;
103
83
  }
@@ -167,15 +147,14 @@ var placeholderFile = {
167
147
  function BeforeAfter(_ref) {
168
148
  var isActive = _ref.isActive,
169
149
  load = _ref.load,
150
+ caption = _ref.caption,
170
151
  position = _ref.position,
171
152
  before_id = _ref.before_id,
172
153
  before_label = _ref.before_label,
173
154
  after_id = _ref.after_id,
174
155
  after_label = _ref.after_label,
175
156
  initial_slider_position = _ref.initial_slider_position,
176
- slider = _ref.slider,
177
- slider_color = _ref.slider_color,
178
- slider_handle = _ref.slider_handle;
157
+ slider_color = _ref.slider_color;
179
158
 
180
159
  var _useState = useState(false),
181
160
  _useState2 = _slicedToArray(_useState, 2),
@@ -211,86 +190,48 @@ function BeforeAfter(_ref) {
211
190
  var afterImageUrl = afterImage && afterImage.urls.large;
212
191
  var afterImageAlt = afterImage && afterImage.configuration.alt;
213
192
  var initialSliderPos = initial_slider_position / 100;
214
- var opts = {}; // Transform slider-related props into the format that
215
- // react-compare-image needs
216
-
217
- if (!slider) {
218
- opts = _objectSpread2(_objectSpread2({}, opts), {}, {
219
- sliderLineWidth: 0,
220
- handle:
221
- /*#__PURE__*/
222
- React.createElement(React.Fragment, null)
223
- });
224
- }
225
-
226
- if (slider) {
227
- if (!slider_handle) {
228
- opts = _objectSpread2(_objectSpread2({}, opts), {}, {
229
- handle:
230
- /*#__PURE__*/
231
- React.createElement(React.Fragment, null)
232
- });
233
- }
234
-
235
- if (slider_color) {
236
- opts = _objectSpread2(_objectSpread2({}, opts), {}, {
237
- sliderLineColor: slider_color
238
- });
239
- }
240
- }
241
-
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
- );
193
+ return /*#__PURE__*/React.createElement(FitViewport, {
194
+ file: beforeImage || afterImage || placeholderFile
195
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
196
+ caption: caption
197
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(Measure, {
198
+ bounds: true
199
+ }, function (_ref2) {
200
+ var _cx;
201
+
202
+ var measureRef = _ref2.measureRef,
203
+ contentRect = _ref2.contentRect;
204
+ var initialRectWidth = contentRect.bounds.width * initialSliderPos + 'px';
205
+ return /*#__PURE__*/React.createElement("div", {
206
+ ref: measureRef,
207
+ style: {
208
+ '--initial-rect-width': initialRectWidth
209
+ },
210
+ className: classNames((_cx = {}, _defineProperty(_cx, styles$1.selected, isSelected), _defineProperty(_cx, styles$1.wiggle, wiggle && !moved), _cx), styles$1.container)
211
+ }, /*#__PURE__*/React.createElement(InitialSliderPositionIndicator, {
212
+ parentSelected: isSelected,
213
+ position: initial_slider_position
214
+ }), renderCompareImage());
215
+ })))));
273
216
 
274
217
  function renderCompareImage() {
275
218
  if (!load) {
276
219
  return null;
277
220
  }
278
221
 
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
- );
222
+ return /*#__PURE__*/React.createElement(ReactCompareImage, {
223
+ leftImage: beforeImage ? beforeImageUrl : placeholderForBeforeImage,
224
+ rightImage: afterImage ? afterImageUrl : placeholderForAfterImage,
225
+ leftImageLabel: before_label,
226
+ rightImageLabel: after_label,
227
+ leftImageAlt: beforeImageAlt,
228
+ rightImageAlt: afterImageAlt,
229
+ sliderPositionPercentage: initialSliderPos,
230
+ onSliderPositionChange: function onSliderPositionChange() {
231
+ return setMoved(true);
232
+ },
233
+ sliderLineColor: slider_color || undefined
234
+ });
294
235
  }
295
236
  }
296
237
 
@@ -307,9 +248,7 @@ function InitialSliderPositionIndicator(_ref3) {
307
248
  }; // In case this element is selected, and its initial slider position
308
249
  // is not in the middle, we show InitialSliderPositionIndicator
309
250
 
310
- return parentSelected && position !== 50 ?
311
- /*#__PURE__*/
312
- React.createElement("div", {
251
+ return parentSelected && position !== 50 ? /*#__PURE__*/React.createElement("div", {
313
252
  className: styles$1.sliderStart,
314
253
  style: indicatorStyles
315
254
  }) : '';
@@ -320,13 +259,10 @@ function InlineBeforeAfter(props) {
320
259
  isActive = _useContentElementLif.isActive,
321
260
  shouldLoad = _useContentElementLif.shouldLoad;
322
261
 
323
- return (
324
- /*#__PURE__*/
325
- React.createElement(BeforeAfter, Object.assign({}, props.configuration, {
326
- load: shouldLoad,
327
- isActive: isActive
328
- }))
329
- );
262
+ return /*#__PURE__*/React.createElement(BeforeAfter, Object.assign({}, props.configuration, {
263
+ load: shouldLoad,
264
+ isActive: isActive
265
+ }));
330
266
  }
331
267
 
332
268
  frontend.contentElementTypes.register('inlineBeforeAfter', {
@@ -336,34 +272,63 @@ frontend.contentElementTypes.register('inlineBeforeAfter', {
336
272
 
337
273
  function InlineImage(_ref) {
338
274
  var configuration = _ref.configuration;
339
-
340
- var _useContentElementLif = useContentElementLifecycle(),
341
- shouldLoad = _useContentElementLif.shouldLoad;
342
-
343
275
  var imageFile = useFile({
344
276
  collectionName: 'imageFiles',
345
277
  permaId: configuration.id
346
278
  });
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, {
279
+ var portraitImageFile = useFile({
280
+ collectionName: 'imageFiles',
281
+ permaId: configuration.portraitId
282
+ }); // Only render OrientationAwareInlineImage if a portrait image has
283
+ // been selected. This prevents having the component rerender on
284
+ // orientation changes even if it does not depend on orientation at
285
+ // all.
286
+
287
+ if (portraitImageFile) {
288
+ return /*#__PURE__*/React.createElement(OrientationAwareInlineImage, {
289
+ landscapeImageFile: imageFile,
290
+ portraitImageFile: portraitImageFile,
291
+ configuration: configuration
292
+ });
293
+ } else {
294
+ return /*#__PURE__*/React.createElement(ImageWithCaption, {
361
295
  imageFile: imageFile,
362
- load: shouldLoad,
363
- structuredData: true,
364
- variant: configuration.position === 'full' ? 'large' : 'medium'
365
- })))
366
- );
296
+ configuration: configuration
297
+ });
298
+ }
299
+ }
300
+
301
+ function OrientationAwareInlineImage(_ref2) {
302
+ var landscapeImageFile = _ref2.landscapeImageFile,
303
+ portraitImageFile = _ref2.portraitImageFile,
304
+ configuration = _ref2.configuration;
305
+ var portraitOrientation = usePortraitOrientation();
306
+ var imageFile = portraitOrientation && portraitImageFile ? portraitImageFile : landscapeImageFile;
307
+ return /*#__PURE__*/React.createElement(ImageWithCaption, {
308
+ imageFile: imageFile,
309
+ configuration: configuration
310
+ });
311
+ }
312
+
313
+ function ImageWithCaption(_ref3) {
314
+ var imageFile = _ref3.imageFile,
315
+ configuration = _ref3.configuration;
316
+
317
+ var _useContentElementLif = useContentElementLifecycle(),
318
+ shouldLoad = _useContentElementLif.shouldLoad;
319
+
320
+ return /*#__PURE__*/React.createElement(FitViewport, {
321
+ file: imageFile,
322
+ aspectRatio: imageFile ? undefined : 0.75,
323
+ opaque: !imageFile
324
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
325
+ caption: configuration.caption
326
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(Image, {
327
+ imageFile: imageFile,
328
+ load: shouldLoad,
329
+ structuredData: true,
330
+ variant: configuration.position === 'full' ? 'large' : 'medium'
331
+ })))));
367
332
  }
368
333
 
369
334
  frontend.contentElementTypes.register('inlineImage', {
@@ -371,6 +336,108 @@ frontend.contentElementTypes.register('inlineImage', {
371
336
  lifecycle: true
372
337
  });
373
338
 
339
+ var styles$2 = {"wrapper":"MutedIndicator-module_wrapper__17JUY","visible":"MutedIndicator-module_visible__3qARn","eqBar":"MutedIndicator-module_eqBar__1cMDE","eqBar1":"MutedIndicator-module_eqBar1__2Ap_R MutedIndicator-module_eqBar__1cMDE","short-eq":"MutedIndicator-module_short-eq__1OYlk","eqBar2":"MutedIndicator-module_eqBar2__2QTgX MutedIndicator-module_eqBar__1cMDE","tall-eq":"MutedIndicator-module_tall-eq__6gm0B","eqBar3":"MutedIndicator-module_eqBar3__2S-y3 MutedIndicator-module_eqBar__1cMDE"};
340
+
341
+ function MutedIndicator(_ref) {
342
+ var visible = _ref.visible;
343
+ return /*#__PURE__*/React.createElement("div", {
344
+ className: classNames(styles$2.wrapper, _defineProperty({}, styles$2.visible, visible))
345
+ }, /*#__PURE__*/React.createElement("svg", {
346
+ xmlns: "http://www.w3.org/2000/svg",
347
+ width: "24",
348
+ height: "24",
349
+ viewBox: "0 0 24 24"
350
+ }, /*#__PURE__*/React.createElement("rect", {
351
+ className: styles$2.eqBar1,
352
+ x: "4",
353
+ y: "4",
354
+ width: "3.7",
355
+ height: "8"
356
+ }), /*#__PURE__*/React.createElement("rect", {
357
+ className: styles$2.eqBar2,
358
+ x: "10.2",
359
+ y: "4",
360
+ width: "3.7",
361
+ height: "16"
362
+ }), /*#__PURE__*/React.createElement("rect", {
363
+ className: styles$2.eqBar3,
364
+ x: "16.3",
365
+ y: "4",
366
+ width: "3.7",
367
+ height: "11"
368
+ })));
369
+ }
370
+
371
+ function getLifecycleHandlers(configuration, playerActions) {
372
+ return {
373
+ onVisible: function onVisible() {
374
+ if (configuration.playbackMode === 'loop') {
375
+ playerActions.play();
376
+ }
377
+ },
378
+ onActivate: function onActivate() {
379
+ if (configuration.playbackMode === 'autoplay' || !configuration.playbackMode && configuration.autoplay) {
380
+ playerActions.play({
381
+ via: 'autoplay'
382
+ });
383
+ }
384
+ },
385
+ onDeactivate: function onDeactivate() {
386
+ if (configuration.playbackMode !== 'loop') {
387
+ playerActions.fadeOutAndPause(400);
388
+ }
389
+ },
390
+ onInvisible: function onInvisible() {
391
+ if (configuration.playbackMode === 'loop') {
392
+ playerActions.fadeOutAndPause(400);
393
+ }
394
+ }
395
+ };
396
+ }
397
+ function getPlayerClickHandler(_ref) {
398
+ var configuration = _ref.configuration,
399
+ playerActions = _ref.playerActions,
400
+ shouldPlay = _ref.shouldPlay,
401
+ lastControlledVia = _ref.lastControlledVia,
402
+ mediaMuted = _ref.mediaMuted,
403
+ isEditable = _ref.isEditable,
404
+ isSelected = _ref.isSelected;
405
+
406
+ if (isEditable && !isSelected) {
407
+ return null;
408
+ } else if (configuration.playbackMode === 'loop') {
409
+ if (mediaMuted && !configuration.keepMuted) {
410
+ return function () {
411
+ return playerActions.playBlessed();
412
+ };
413
+ } else {
414
+ return null;
415
+ }
416
+ } else if (configuration.keepMuted) {
417
+ return function () {
418
+ if (shouldPlay) {
419
+ playerActions.pause();
420
+ } else {
421
+ playerActions.play();
422
+ }
423
+ };
424
+ } else {
425
+ return function () {
426
+ if (shouldPlay && mediaMuted) {
427
+ if (configuration.rewindOnUnmute && lastControlledVia === 'autoplay') {
428
+ playerActions.seekTo(0);
429
+ }
430
+
431
+ playerActions.playBlessed();
432
+ } else if (shouldPlay) {
433
+ playerActions.pause();
434
+ } else {
435
+ playerActions.playBlessed();
436
+ }
437
+ };
438
+ }
439
+ }
440
+
374
441
  function InlineVideo(_ref) {
375
442
  var contentElementId = _ref.contentElementId,
376
443
  sectionProps = _ref.sectionProps,
@@ -389,20 +456,43 @@ function InlineVideo(_ref) {
389
456
  playerState = _usePlayerState2[0],
390
457
  playerActions = _usePlayerState2[1];
391
458
 
459
+ return /*#__PURE__*/React.createElement(MediaInteractionTracking, {
460
+ playerState: playerState,
461
+ playerActions: playerActions
462
+ }, /*#__PURE__*/React.createElement(FitViewport, {
463
+ file: videoFile,
464
+ aspectRatio: videoFile ? undefined : fallbackAspectRatio,
465
+ opaque: !videoFile
466
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
467
+ caption: configuration.caption
468
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(MutedIndicator, {
469
+ visible: media.muted && playerState.shouldPlay && !configuration.keepMuted
470
+ }), /*#__PURE__*/React.createElement(Player, {
471
+ key: configuration.playbackMode === 'loop',
472
+ videoFile: videoFile,
473
+ posterImageFile: posterImageFile,
474
+ playerState: playerState,
475
+ playerActions: playerActions,
476
+ contentElementId: contentElementId,
477
+ sectionProps: sectionProps,
478
+ configuration: configuration
479
+ }))))));
480
+ }
481
+
482
+ function Player(_ref2) {
483
+ var videoFile = _ref2.videoFile,
484
+ posterImageFile = _ref2.posterImageFile,
485
+ playerState = _ref2.playerState,
486
+ playerActions = _ref2.playerActions,
487
+ contentElementId = _ref2.contentElementId,
488
+ sectionProps = _ref2.sectionProps,
489
+ configuration = _ref2.configuration;
490
+
392
491
  var _useContentElementEdi = useContentElementEditorState(),
393
492
  isEditable = _useContentElementEdi.isEditable,
394
493
  isSelected = _useContentElementEdi.isSelected;
395
494
 
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);
404
- }
405
- }),
495
+ var _useContentElementLif = useContentElementLifecycle(getLifecycleHandlers(configuration, playerActions)),
406
496
  shouldLoad = _useContentElementLif.shouldLoad,
407
497
  shouldPrepare = _useContentElementLif.shouldPrepare;
408
498
 
@@ -410,59 +500,62 @@ function InlineVideo(_ref) {
410
500
  key: contentElementId,
411
501
  request: playerState.shouldPlay,
412
502
  onLost: function onLost() {
413
- playerActions.fadeOutAndPause(400);
503
+ if (configuration.playbackMode !== 'loop') {
504
+ playerActions.fadeOutAndPause(400);
505
+ }
414
506
  }
415
507
  });
416
-
417
- var onPlayerClick = function onPlayerClick() {
418
- if (isEditable && !isSelected) {
508
+ var onPlayerClick = getPlayerClickHandler({
509
+ configuration: configuration,
510
+ playerActions: playerActions,
511
+ shouldPlay: playerState.shouldPlay,
512
+ lastControlledVia: playerState.lastControlledVia,
513
+ mediaMuted: media.muted,
514
+ isEditable: isEditable,
515
+ isSelected: isSelected
516
+ });
517
+ useEffect(function () {
518
+ if (configuration.playbackMode !== 'loop') {
419
519
  return;
420
520
  }
421
521
 
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
- );
522
+ var documentState = documentHiddenState(function (visibilityState) {
523
+ if (visibilityState === 'hidden') {
524
+ playerActions.fadeOutAndPause(400);
525
+ } else {
526
+ playerActions.play();
527
+ }
528
+ });
529
+ return function () {
530
+ return documentState.removeCallback();
531
+ };
532
+ }, [playerActions, configuration.playbackMode]);
533
+ return /*#__PURE__*/React.createElement(VideoPlayerControls, {
534
+ videoFile: videoFile,
535
+ defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
536
+ playerState: playerState,
537
+ playerActions: playerActions,
538
+ hideControlBar: configuration.hideControlBar || configuration.playbackMode === 'loop',
539
+ hideBigPlayButton: configuration.playbackMode === 'loop',
540
+ configuration: configuration,
541
+ sectionProps: sectionProps,
542
+ onPlayerClick: onPlayerClick
543
+ }, /*#__PURE__*/React.createElement(VideoPlayer, {
544
+ load: shouldPrepare ? 'auto' : shouldLoad ? 'poster' : 'none',
545
+ loop: configuration.playbackMode === 'loop',
546
+ playerState: playerState,
547
+ playerActions: playerActions,
548
+ videoFile: videoFile,
549
+ posterImageFile: posterImageFile,
550
+ defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
551
+ quality: 'high',
552
+ playsInline: true,
553
+ atmoDuringPlayback: configuration.atmoDuringPlayback
554
+ }));
464
555
  }
465
556
 
557
+ var fallbackAspectRatio = 0.5625;
558
+
466
559
  frontend.contentElementTypes.register('inlineVideo', {
467
560
  component: InlineVideo,
468
561
  lifecycle: true
@@ -523,37 +616,31 @@ function InlineAudio(_ref) {
523
616
  }
524
617
  };
525
618
 
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
- );
619
+ return /*#__PURE__*/React.createElement(FitViewport, {
620
+ file: posterImageFile
621
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
622
+ caption: configuration.caption
623
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, /*#__PURE__*/React.createElement(AudioPlayerControls, {
624
+ audioFile: audioFile,
625
+ defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
626
+ playerState: playerState,
627
+ playerActions: playerActions,
628
+ standAlone: !posterImageFile,
629
+ configuration: configuration,
630
+ sectionProps: sectionProps,
631
+ onPlayerClick: onPlayerClick
632
+ }, /*#__PURE__*/React.createElement(AudioPlayer, {
633
+ load: shouldPrepare ? 'auto' : shouldLoad ? 'poster' : 'none',
634
+ controls: configuration.controls,
635
+ playerState: playerState,
636
+ playerActions: playerActions,
637
+ audioFile: audioFile,
638
+ posterImageFile: posterImageFile,
639
+ defaultTextTrackFilePermaId: configuration.defaultTextTrackFileId,
640
+ quality: 'high',
641
+ playsInline: true,
642
+ atmoDuringPlayback: configuration.atmoDuringPlayback
643
+ }))))));
557
644
  }
558
645
 
559
646
  frontend.contentElementTypes.register('inlineAudio', {
@@ -561,7 +648,7 @@ frontend.contentElementTypes.register('inlineAudio', {
561
648
  lifecycle: true
562
649
  });
563
650
 
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"};
651
+ var styles$3 = {"soundDisclaimer":"SoundDisclaimer-module_soundDisclaimer__31hWh","unmute":"SoundDisclaimer-module_unmute__1V4Ab","unmuted":"SoundDisclaimer-module_unmuted__22CJ5","active":"SoundDisclaimer-module_active__11_kc"};
565
652
 
566
653
  function _objectWithoutPropertiesLoose(source, excluded) {
567
654
  if (source == null) return {};
@@ -619,14 +706,14 @@ var MutedIcon = (function (_ref) {
619
706
  styles = _ref$styles === void 0 ? {} : _ref$styles,
620
707
  props = _objectWithoutProperties(_ref, ["styles"]);
621
708
 
622
- return React.createElement("svg", _extends({
709
+ return /*#__PURE__*/React.createElement("svg", _extends({
623
710
  "aria-hidden": "true",
624
711
  "data-prefix": "fas",
625
712
  "data-icon": "volume-mute",
626
713
  className: (styles["svg-inline--fa"] || "svg-inline--fa") + " " + (styles["fa-volume-mute"] || "fa-volume-mute") + " " + (styles["fa-w-16"] || "fa-w-16"),
627
714
  xmlns: "http://www.w3.org/2000/svg",
628
715
  viewBox: "0 0 512 512"
629
- }, props), React.createElement("path", {
716
+ }, props), /*#__PURE__*/React.createElement("path", {
630
717
  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"
631
718
  }));
632
719
  });
@@ -653,14 +740,14 @@ var UnmutedIcon = (function (_ref) {
653
740
  styles = _ref$styles === void 0 ? {} : _ref$styles,
654
741
  props = _objectWithoutProperties(_ref, ["styles"]);
655
742
 
656
- return React.createElement("svg", _extends$1({
743
+ return /*#__PURE__*/React.createElement("svg", _extends$1({
657
744
  "aria-hidden": "true",
658
745
  "data-prefix": "fas",
659
746
  "data-icon": "volume-mute",
660
747
  className: (styles["svg-inline--fa"] || "svg-inline--fa") + " " + (styles["fa-volume-mute"] || "fa-volume-mute") + " " + (styles["fa-w-16"] || "fa-w-16"),
661
748
  xmlns: "http://www.w3.org/2000/svg",
662
749
  viewBox: "0 0 512 512"
663
- }, props), React.createElement("path", {
750
+ }, props), /*#__PURE__*/React.createElement("path", {
664
751
  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
752
  }));
666
753
  });
@@ -674,49 +761,34 @@ function SoundDisclaimer() {
674
761
  t = _useI18n.t;
675
762
 
676
763
  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
- );
764
+ return /*#__PURE__*/React.createElement("div", {
765
+ className: classNames(styles$3.soundDisclaimer),
766
+ style: {
767
+ pointerEvents: isEditable && !isSelected ? 'none' : undefined
768
+ }
769
+ }, /*#__PURE__*/React.createElement("button", {
770
+ className: classNames(styles$3.unmute, _defineProperty({}, styles$3.active, muted)),
771
+ onClick: function onClick() {
772
+ return media.mute(false);
773
+ }
774
+ }, /*#__PURE__*/React.createElement(MutedIcon, null), /*#__PURE__*/React.createElement("p", {
775
+ dangerouslySetInnerHTML: {
776
+ __html: t('pageflow_scrolled.public.sound_disclaimer.help_muted')
777
+ }
778
+ })), /*#__PURE__*/React.createElement("div", {
779
+ className: classNames(styles$3.unmuted, _defineProperty({}, styles$3.active, !muted))
780
+ }, /*#__PURE__*/React.createElement(UnmutedIcon, null), /*#__PURE__*/React.createElement("p", {
781
+ dangerouslySetInnerHTML: {
782
+ __html: t('pageflow_scrolled.public.sound_disclaimer.help_unmuted')
783
+ }
784
+ })));
713
785
  }
714
786
 
715
787
  frontend.contentElementTypes.register('soundDisclaimer', {
716
788
  component: SoundDisclaimer
717
789
  });
718
790
 
719
- var styles$3 = {"text":"TextBlock-module_text__21Hk4"};
791
+ var styles$4 = {"text":"TextBlock-module_text__21Hk4","layout-centerRagged":"TextBlock-module_layout-centerRagged__1tjoI"};
720
792
 
721
793
  function TextBlock(props) {
722
794
  var updateConfiguration = useContentElementConfigurationUpdate();
@@ -726,23 +798,18 @@ function TextBlock(props) {
726
798
  }),
727
799
  t = _useI18n.t;
728
800
 
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
- );
801
+ return /*#__PURE__*/React.createElement("div", {
802
+ className: classNames(styles$4.text, styles$4["layout-".concat(props.sectionProps.layout)])
803
+ }, /*#__PURE__*/React.createElement(EditableText, {
804
+ value: props.configuration.value,
805
+ contentElementId: props.contentElementId,
806
+ placeholder: t('pageflow_scrolled.inline_editing.type_text'),
807
+ onChange: function onChange(value) {
808
+ return updateConfiguration({
809
+ value: value
810
+ });
811
+ }
812
+ }));
746
813
  }
747
814
 
748
815
  frontend.contentElementTypes.register('textBlock', {
@@ -751,7 +818,22 @@ frontend.contentElementTypes.register('textBlock', {
751
818
  supportsWrappingAroundFloats: true
752
819
  });
753
820
 
754
- var styles$4 = {"VideoEmbed":"VideoEmbed-module_VideoEmbed__3BUjc","embedPlayer":"VideoEmbed-module_embedPlayer__54NKG"};
821
+ var youtubeMatcher = /youtube\.com\/|youtu\.be\//;
822
+ var vimeoMatcher = /vimeo\.com\//;
823
+ var facebookMatcher = /facebook\.com\//;
824
+ function getProviderName(url) {
825
+ if (youtubeMatcher.test(url)) {
826
+ return 'youtube';
827
+ } else if (vimeoMatcher.test(url)) {
828
+ return 'vimeo';
829
+ } else if (facebookMatcher.test(url)) {
830
+ return 'facebook';
831
+ }
832
+
833
+ return null;
834
+ }
835
+
836
+ var styles$5 = {"embedPlayer":"VideoEmbed-module_embedPlayer__54NKG"};
755
837
 
756
838
  var aspectRatios = {
757
839
  wide: 0.5625,
@@ -775,52 +857,46 @@ function VideoEmbed(_ref) {
775
857
  playerState = _useState2[0],
776
858
  setPlayerState = _useState2[1];
777
859
 
778
- return (
779
- /*#__PURE__*/
780
- React.createElement("div", {
781
- className: styles$4.VideoEmbed,
782
- style: {
783
- pointerEvents: isEditable && !isSelected ? 'none' : undefined
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
- );
860
+ var providerName = getProviderName(configuration.videoSource);
861
+ return /*#__PURE__*/React.createElement("div", {
862
+ style: {
863
+ pointerEvents: isEditable && !isSelected ? 'none' : undefined
864
+ }
865
+ }, /*#__PURE__*/React.createElement(FitViewport, {
866
+ aspectRatio: aspectRatios[configuration.aspectRatio || 'wide']
867
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
868
+ caption: configuration.caption
869
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, shouldLoad && /*#__PURE__*/React.createElement(PreparedPlayer, {
870
+ playerState: playerState,
871
+ setPlayerState: setPlayerState,
872
+ contentElementId: contentElementId,
873
+ configuration: configuration,
874
+ providerName: providerName
875
+ })), /*#__PURE__*/React.createElement(ThirdPartyOptOutInfo, {
876
+ providerName: providerName,
877
+ hide: playerState === 'playing',
878
+ contentElementPosition: configuration.position
879
+ })))));
810
880
  }
811
881
 
812
882
  function PreparedPlayer(_ref2) {
813
883
  var contentElementId = _ref2.contentElementId,
814
884
  configuration = _ref2.configuration,
815
885
  playerState = _ref2.playerState,
816
- setPlayerState = _ref2.setPlayerState;
886
+ setPlayerState = _ref2.setPlayerState,
887
+ providerName = _ref2.providerName;
817
888
  useAudioFocus({
818
889
  key: contentElementId,
819
890
  request: playerState === 'playing',
820
891
  onLost: function onLost() {
821
892
  setPlayerState('paused');
822
893
  }
823
- }); // React player does not re-create player when controls or config
894
+ });
895
+ var posterImageFile = useFile({
896
+ collectionName: 'imageFiles',
897
+ permaId: configuration.posterId
898
+ });
899
+ var posterUrl = (posterImageFile === null || posterImageFile === void 0 ? void 0 : posterImageFile.isReady) && posterImageFile.urls.large; // React player does not re-create player when controls or config
824
900
  // prop changes. Ensure key changes to force React to re-mount
825
901
  // component.
826
902
 
@@ -828,56 +904,67 @@ function PreparedPlayer(_ref2) {
828
904
  return [config.hideControls, config.hideInfo].join('');
829
905
  }
830
906
 
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
- }
907
+ return /*#__PURE__*/React.createElement(ThirdPartyOptIn, {
908
+ providerName: providerName
909
+ }, function (_ref3) {
910
+ var consentedHere = _ref3.consentedHere;
911
+ return /*#__PURE__*/React.createElement(ReactPlayer, {
912
+ className: styles$5.embedPlayer,
913
+ key: keyFromConfiguration(configuration),
914
+ url: configuration.videoSource,
915
+ playing: playerState !== 'paused',
916
+ onPlay: function onPlay() {
917
+ return setPlayerState('playing');
918
+ },
919
+ onPause: function onPause() {
920
+ return setPlayerState('paused');
921
+ },
922
+ onEnded: function onEnded() {
923
+ return setPlayerState('paused');
924
+ },
925
+ light: !consentedHere && playerState === 'unplayed' ? posterUrl || true : false,
926
+ width: "100%",
927
+ height: "100%",
928
+ controls: !configuration.hideControls,
929
+ config: {
930
+ youtube: {
931
+ playerVars: {
932
+ showinfo: !configuration.hideInfo
868
933
  }
869
- })
870
- );
871
- })
872
- );
934
+ },
935
+ vimeo: {
936
+ playerOptions: {
937
+ byline: !configuration.hideInfo
938
+ }
939
+ }
940
+ }
941
+ });
942
+ });
873
943
  }
874
944
 
875
945
  frontend.contentElementTypes.register('videoEmbed', {
876
946
  component: VideoEmbed,
877
- lifecycle: true
947
+ lifecycle: true,
948
+ consentVendors: function consentVendors(_ref) {
949
+ var configuration = _ref.configuration,
950
+ t = _ref.t;
951
+ var provider = getProviderName(configuration.videoSource);
952
+
953
+ if (provider) {
954
+ var prefix = 'pageflow_scrolled.public.video_embed.consent';
955
+ return [{
956
+ name: provider,
957
+ displayName: t("".concat(prefix, ".").concat(provider, ".vendor_name")),
958
+ description: t("".concat(prefix, ".").concat(provider, ".vendor_description")),
959
+ paradigm: 'lazy opt-in'
960
+ }];
961
+ }
962
+
963
+ return [];
964
+ }
878
965
  });
879
966
 
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"};
967
+ var styles$6 = {"darkContentSurfaceColor":"var(--theme-dark-content-surface-color, #101010)","lightContentSurfaceColor":"var(--theme-light-content-surface-color, #fff)","darkContentTextColor":"var(--theme-dark-content-text-color, #222)","lightContentTextColor":"var(--theme-light-content-text-color, #fff)","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"};
881
968
 
882
969
  function ExternalLink(props) {
883
970
  var _classNames2;
@@ -902,6 +989,7 @@ function ExternalLink(props) {
902
989
  collectionName: 'imageFiles',
903
990
  permaId: props.thumbnail
904
991
  });
992
+ var url = ensureAbsolute(props.url);
905
993
 
906
994
  var onClick = function onClick(event) {
907
995
  if (isEditable) {
@@ -922,58 +1010,51 @@ function ExternalLink(props) {
922
1010
  function renderNewTabTooltip() {
923
1011
  if (isEditable) {
924
1012
  var onTooltipClick = function onTooltipClick() {
925
- window.open(props.url, '_blank');
1013
+ window.open(url, '_blank');
926
1014
  setHideTooltip(true);
927
1015
  };
928
1016
 
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
- );
1017
+ return /*#__PURE__*/React.createElement("div", {
1018
+ className: classNames(_defineProperty({}, styles$6.hidden, hideTooltip), styles$6.tooltip),
1019
+ onClick: onTooltipClick
1020
+ }, t('pageflow_scrolled.inline_editing.external_links.open_in_new_tab_message'), /*#__PURE__*/React.createElement("span", null, t('pageflow_scrolled.inline_editing.external_links.open_in_new_tab')));
938
1021
  }
939
1022
  }
940
1023
 
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
- );
1024
+ return /*#__PURE__*/React.createElement("a", {
1025
+ className: classNames(styles$6.link_item, (_classNames2 = {}, _defineProperty(_classNames2, styles$6.invert, props.invert), _defineProperty(_classNames2, styles$6.layout_center, layout === 'center' || layout === 'centerRagged'), _classNames2)),
1026
+ href: url || 'about:blank',
1027
+ onClick: onClick,
1028
+ onMouseLeave: onMouseLeave,
1029
+ target: props.open_in_new_tab ? '_blank' : '_self',
1030
+ rel: props.open_in_new_tab ? 'noopen noreferrer' : undefined
1031
+ }, /*#__PURE__*/React.createElement("div", {
1032
+ className: styles$6.link_thumbnail
1033
+ }, /*#__PURE__*/React.createElement(Image, {
1034
+ imageFile: thumbnailImageFile,
1035
+ load: props.loadImages,
1036
+ variant: "linkThumbnailLarge"
1037
+ })), /*#__PURE__*/React.createElement("div", {
1038
+ className: styles$6.link_details
1039
+ }, /*#__PURE__*/React.createElement("p", {
1040
+ className: styles$6.link_title
1041
+ }, props.title), /*#__PURE__*/React.createElement("p", {
1042
+ className: styles$6.link_desc
1043
+ }, props.description)), renderNewTabTooltip());
1044
+ }
1045
+ ExternalLink.defaultProps = {
1046
+ sectionProps: {}
1047
+ };
1048
+
1049
+ function ensureAbsolute(url) {
1050
+ if (url.match(/^(https?:)?\/\//)) {
1051
+ return url;
1052
+ } else {
1053
+ return "http://".concat(url);
1054
+ }
974
1055
  }
975
1056
 
976
- var styles$6 = {"ext_links_container":"ExternalLinkList-module_ext_links_container__16IIo"};
1057
+ var styles$7 = {"ext_links_container":"ExternalLinkList-module_ext_links_container__16IIo scope-externalLinks"};
977
1058
 
978
1059
  function ExternalLinkList(props) {
979
1060
  var linkList = props.configuration.links || [];
@@ -982,22 +1063,16 @@ function ExternalLinkList(props) {
982
1063
  shouldLoad = _useContentElementLif.shouldLoad;
983
1064
 
984
1065
  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
- );
1066
+ return /*#__PURE__*/React.createElement("div", {
1067
+ className: styles$7.ext_links_container
1068
+ }, linkList.map(function (link, index) {
1069
+ return /*#__PURE__*/React.createElement(ExternalLink, Object.assign({}, link, {
1070
+ key: link.id,
1071
+ invert: !darkBackground,
1072
+ sectionProps: props.sectionProps,
1073
+ loadImages: shouldLoad
1074
+ }));
1075
+ }));
1001
1076
  }
1002
1077
 
1003
1078
  frontend.contentElementTypes.register('externalLinkList', {
@@ -1031,7 +1106,7 @@ function useIframeHeight(url) {
1031
1106
  return height;
1032
1107
  }
1033
1108
 
1034
- var styles$7 = {"container":"DataWrapperChart-module_container__2eZ15"};
1109
+ var styles$8 = {"container":"DataWrapperChart-module_container__2eZ15"};
1035
1110
 
1036
1111
  function DataWrapperChart(_ref) {
1037
1112
  var configuration = _ref.configuration;
@@ -1055,32 +1130,33 @@ function DataWrapperChart(_ref) {
1055
1130
  }
1056
1131
 
1057
1132
  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"
1133
+ return /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
1134
+ caption: configuration.caption
1135
+ }, /*#__PURE__*/React.createElement("div", {
1136
+ className: styles$8.container,
1137
+ style: {
1138
+ pointerEvents: isEditable && !isSelected ? 'none' : undefined,
1139
+ backgroundColor: backgroundColor,
1140
+ color: textColorForBackgroundColor(backgroundColor),
1141
+ height: height
1073
1142
  },
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
- );
1143
+ "data-percy": "hide"
1144
+ }, /*#__PURE__*/React.createElement(ThirdPartyOptIn, {
1145
+ providerName: "datawrapper"
1146
+ }, shouldLoad && renderIframe(srcURL, configuration.title || t('pageflow_scrolled.public.chart.default_title'))), /*#__PURE__*/React.createElement(DatawrapperOptOutInfo, {
1147
+ providerName: "datawrapper",
1148
+ contentElementPosition: configuration.position
1149
+ }))));
1150
+ }
1151
+
1152
+ function DatawrapperOptOutInfo(props) {
1153
+ if (!features.isEnabled('datawrapper_chart_embed_opt_in')) {
1154
+ return null;
1155
+ }
1156
+
1157
+ return /*#__PURE__*/React.createElement(ThirdPartyOptOutInfo, Object.assign({
1158
+ providerName: "datawrapper"
1159
+ }, props));
1084
1160
  }
1085
1161
 
1086
1162
  function renderIframe(url, title) {
@@ -1088,82 +1164,196 @@ function renderIframe(url, title) {
1088
1164
  return null;
1089
1165
  }
1090
1166
 
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
- );
1167
+ return /*#__PURE__*/React.createElement("iframe", {
1168
+ src: url,
1169
+ title: title,
1170
+ scrolling: "no",
1171
+ allowFullScreen: true,
1172
+ mozallowfullscreen: "true",
1173
+ webkitallowfullscreen: "true"
1174
+ });
1102
1175
  }
1103
1176
 
1104
1177
  frontend.contentElementTypes.register('dataWrapperChart', {
1105
1178
  component: DataWrapperChart,
1106
- lifecycle: true
1179
+ lifecycle: true,
1180
+ consentVendors: function consentVendors(_ref) {
1181
+ var configuration = _ref.configuration,
1182
+ t = _ref.t;
1183
+ var prefix = 'pageflow_scrolled.public.chart';
1184
+ return [{
1185
+ name: 'datawrapper',
1186
+ displayName: t("".concat(prefix, ".consent_vendor_name")),
1187
+ description: t("".concat(prefix, ".consent_vendor_description")),
1188
+ paradigm: features.isEnabled('datawrapper_chart_embed_opt_in') ? 'lazy opt-in' : 'skip'
1189
+ }];
1190
+ }
1107
1191
  });
1108
1192
 
1109
- function VrImage(_ref) {
1110
- var configuration = _ref.configuration;
1193
+ function useAutoCruising(_ref) {
1194
+ var viewerRef = _ref.viewerRef,
1195
+ onCancel = _ref.onCancel;
1196
+ var autoCruisingRef = useRef(false);
1197
+ var rafIdRef = useRef();
1198
+ var lastYawRef = useRef(null);
1199
+ var start = useCallback(function () {
1200
+ var viewer = viewerRef.current;
1201
+ var start = new Date().getTime();
1202
+ var pitch = viewer.getPitch();
1203
+ var yaw = viewer.getYaw();
1204
+ var delta = 0;
1205
+
1206
+ if (!autoCruisingRef.current) {
1207
+ rafIdRef.current = window.requestAnimationFrame(tick);
1208
+ autoCruisingRef.current = true;
1209
+ }
1111
1210
 
1112
- var _useContentElementLif = useContentElementLifecycle({
1113
- onActivate: function onActivate() {
1114
- if (viewerRef.current) {
1115
- viewerRef.current.lookAt({
1116
- yaw: viewerRef.current.getYaw() + 20
1117
- }, 1000);
1211
+ function tick() {
1212
+ delta = new Date().getTime() - start;
1213
+
1214
+ if (autoCruisingRef.current && lastYawRef.current !== null && (Math.abs(pitch - viewer.getPitch()) > 0.1 || Math.abs(lastYawRef.current - viewer.getYaw()) > 0.1)) {
1215
+ autoCruisingRef.current = false;
1216
+ lastYawRef.current = null;
1217
+ onCancel();
1218
+ return;
1118
1219
  }
1220
+
1221
+ lastYawRef.current = yaw - delta / 1000 % 360;
1222
+ viewer.lookAt({
1223
+ yaw: lastYawRef.current,
1224
+ pitch: pitch
1225
+ }, 0);
1226
+ autoCruisingRef.current && (rafIdRef.current = window.requestAnimationFrame(tick));
1119
1227
  }
1120
- }),
1228
+ }, [viewerRef, onCancel]);
1229
+ var stop = useCallback(function () {
1230
+ window.cancelAnimationFrame(rafIdRef.current);
1231
+ autoCruisingRef.current = false;
1232
+ lastYawRef.current = null;
1233
+ }, []);
1234
+ useEffect(function () {
1235
+ return stop;
1236
+ }, [stop]);
1237
+ return [start, stop];
1238
+ }
1239
+
1240
+ function VrImage(_ref) {
1241
+ var configuration = _ref.configuration;
1242
+
1243
+ var _useContentElementLif = useContentElementLifecycle(),
1121
1244
  shouldLoad = _useContentElementLif.shouldLoad;
1122
1245
 
1123
1246
  var _useContentElementEdi = useContentElementEditorState(),
1124
1247
  isEditable = _useContentElementEdi.isEditable,
1125
1248
  isSelected = _useContentElementEdi.isSelected;
1126
1249
 
1127
- var viewerRef = useRef();
1128
1250
  var imageFile = useFile({
1129
1251
  collectionName: 'imageFiles',
1130
1252
  permaId: configuration.image
1131
1253
  });
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
- );
1254
+ return /*#__PURE__*/React.createElement("div", {
1255
+ style: {
1256
+ pointerEvents: isEditable && !isSelected ? 'none' : undefined
1257
+ }
1258
+ }, /*#__PURE__*/React.createElement(FitViewport, {
1259
+ aspectRatio: configuration.position === 'full' ? 0.5 : 0.75
1260
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
1261
+ caption: configuration.caption
1262
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, renderLazyPanorama(configuration, imageFile, shouldLoad))))));
1150
1263
  }
1151
1264
 
1152
- function renderLazyPanorama(configuration, imageFile, shouldLoad, viewerRef) {
1265
+ function renderLazyPanorama(configuration, imageFile, shouldLoad) {
1153
1266
  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
- );
1267
+ return /*#__PURE__*/React.createElement(AutoCruisingPanorama, {
1268
+ imageFile: imageFile,
1269
+ initialYaw: configuration.initialYaw,
1270
+ initialPitch: configuration.initialPitch
1271
+ });
1163
1272
  }
1164
1273
  }
1165
1274
 
1275
+ function AutoCruisingPanorama(_ref2) {
1276
+ var imageFile = _ref2.imageFile,
1277
+ initialYaw = _ref2.initialYaw,
1278
+ initialPitch = _ref2.initialPitch;
1279
+ var viewerRef = useRef();
1280
+
1281
+ var _useState = useState(false),
1282
+ _useState2 = _slicedToArray(_useState, 2),
1283
+ hidePanoramaIndicator = _useState2[0],
1284
+ setHidePanoramaIndicator = _useState2[1];
1285
+
1286
+ var _useAutoCruising = useAutoCruising({
1287
+ viewerRef: viewerRef,
1288
+ onCancel: function onCancel() {
1289
+ return setHidePanoramaIndicator(true);
1290
+ }
1291
+ }),
1292
+ _useAutoCruising2 = _slicedToArray(_useAutoCruising, 2),
1293
+ startAutoCruising = _useAutoCruising2[0],
1294
+ stopAutoCruising = _useAutoCruising2[1];
1295
+
1296
+ useContentElementLifecycle({
1297
+ onActivate: function onActivate() {
1298
+ if (viewerRef.current) {
1299
+ startAutoCruising();
1300
+ }
1301
+ }
1302
+ });
1303
+ return /*#__PURE__*/React.createElement(Panorama, {
1304
+ imageFile: imageFile,
1305
+ initialYaw: initialYaw,
1306
+ initialPitch: initialPitch,
1307
+ viewerRef: viewerRef,
1308
+ hidePanoramaIndicator: hidePanoramaIndicator,
1309
+ onReady: startAutoCruising,
1310
+ onFullscreen: stopAutoCruising
1311
+ });
1312
+ }
1313
+
1166
1314
  frontend.contentElementTypes.register('vrImage', {
1167
1315
  component: VrImage,
1168
1316
  lifecycle: true
1169
1317
  });
1318
+
1319
+ var styles$9 = {"wrapper":"IframeEmbed-module_wrapper__3w_LN","iframe":"IframeEmbed-module_iframe__3QVCA","scale-p33":"IframeEmbed-module_scale-p33__MRjVy","scale-p50":"IframeEmbed-module_scale-p50__1EKxu","scale-p75":"IframeEmbed-module_scale-p75__1yT4D"};
1320
+
1321
+ var aspectRatios$1 = {
1322
+ wide: 0.5625,
1323
+ narrow: 0.75,
1324
+ square: 1,
1325
+ portrait: 1.7777
1326
+ };
1327
+ function IframeEmbed(_ref) {
1328
+ var configuration = _ref.configuration;
1329
+
1330
+ var _useContentElementLif = useContentElementLifecycle(),
1331
+ shouldLoad = _useContentElementLif.shouldLoad;
1332
+
1333
+ var _useContentElementEdi = useContentElementEditorState(),
1334
+ isEditable = _useContentElementEdi.isEditable,
1335
+ isSelected = _useContentElementEdi.isSelected;
1336
+
1337
+ var portraitOrientation = usePortraitOrientation();
1338
+ var aspectRatio = portraitOrientation && configuration.portraitAspectRatio ? configuration.portraitAspectRatio : configuration.aspectRatio;
1339
+ return /*#__PURE__*/React.createElement("div", {
1340
+ className: styles$9.wrapper,
1341
+ style: {
1342
+ pointerEvents: isEditable && !isSelected ? 'none' : undefined
1343
+ }
1344
+ }, /*#__PURE__*/React.createElement(FitViewport, {
1345
+ aspectRatio: aspectRatios$1[aspectRatio || 'wide'],
1346
+ opaque: utils.isBlank(configuration.source)
1347
+ }, /*#__PURE__*/React.createElement(ContentElementBox, null, /*#__PURE__*/React.createElement(Figure, {
1348
+ caption: configuration.caption
1349
+ }, /*#__PURE__*/React.createElement(FitViewport.Content, null, shouldLoad && /*#__PURE__*/React.createElement("iframe", {
1350
+ className: classNames(styles$9.iframe, styles$9["scale-".concat(configuration.scale)]),
1351
+ title: configuration.title,
1352
+ src: configuration.source
1353
+ }))))));
1354
+ }
1355
+
1356
+ frontend.contentElementTypes.register('iframeEmbed', {
1357
+ component: IframeEmbed,
1358
+ lifecycle: true
1359
+ });