Sha256: 28e4048840846c579be55dca998a96b466554346bffce9c3a7d842cd16aa2e76

Contents?: true

Size: 1022 Bytes

Versions: 3

Compression:

Stored size: 1022 Bytes

Contents

module Pageflow
  module EmbeddedVideo
    # @api private
    module ConsentHelper
      include PageflowPaged::ThirdPartyEmbedConsentHelper

      def embedded_video_opt_in(entry, configuration)
        vendor_name = embedded_video_consent_vendor_name(configuration)
        return unless vendor_name

        vendor_display_name = I18n.t(
          "pageflow.public.embedded_video.consent.#{vendor_name}.vendor_name"
        )

        third_party_embed_opt_in(
          entry: entry,
          vendor_name: vendor_name,
          message: t('pageflow.public.embedded_video.opt_in_prompt',
                     vendor: vendor_display_name)
        )
      end

      def embedded_video_consent_vendor_name(configuration)
        if configuration['display_embedded_video_url'] =~ /youtube\.com/ ||
           configuration['display_embedded_video_url'] =~ /youtu\.be/
          'youtube'
        elsif configuration['display_embedded_video_url'] =~ /vimeo\.com/
          'vimeo'
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pageflow-embedded-video-1.10.0 app/helpers/pageflow/embedded_video/consent_helper.rb
pageflow-embedded-video-1.9.0 app/helpers/pageflow/embedded_video/consent_helper.rb
pageflow-embedded-video-1.8.0 app/helpers/pageflow/embedded_video/consent_helper.rb