Sha256: c235527a70e7d17efb752a275d6f641e67c4e5bfff54b73f4368b5c238a61216

Contents?: true

Size: 800 Bytes

Versions: 2

Compression:

Stored size: 800 Bytes

Contents

module Workarea
  module Storefront
    module KlarnaHelper
      def klarna_on_site_messaging_javacript_tag
        return unless Workarea::Klarna.on_site_messaging?

        javascript_include_tag(
          klarna_on_site_messaging_url,
          async: true,
          data: {
            client_id:  Workarea::Klarna.on_site_messaging_client_id,
            klarna_on_site_messaging: ''
          }
        )
      end

      def klarna_on_site_messaging_url
        region = Workarea.config.klarna_on_site_messaging_region
        subdomains = [
          Workarea.config.klarna_on_site_messaging_subdomains[region],
          ('playground' if Workarea.config.klarna_playground)
        ]

        "https://#{subdomains.compact.join('.')}.klarnaservices.com/lib.js"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-klarna-1.1.0 app/helpers/workarea/storefront/klarna_helper.rb
workarea-klarna-1.1.0.beta1 app/helpers/workarea/storefront/klarna_helper.rb