3.0.2 • Published 3 years ago

@ta-interaktiv/react-paywall v3.0.2

Weekly downloads
58
License
ISC
Repository
gitlab
Last release
3 years ago

Tamedia Paywall Integration as React Component

A way to integrate the Tamedia paywall into your projects, in case you have to.

Installation

yarn add @ta-interaktiv/react-paywall

Usage

This component is already integrated into @ta-interaktiv/react-masthead and enabled by default. As long as you use the masthead as part of your project, you should be good to go. In other cases, refer to the example below.

Example outside of Masthead

import * as React from 'react'
import { Paywall as TamediaPaywall } from '@ta-interaktiv/react-paywall'
import { json } from 'd3-fetch'

export class MyComponent extends React.Component {
  state = {
    paywallConfiguration: {},
    paywallStatus: 0
  }

  render() {
    return (
      <div>
        {this.state.paywallStatus > 0
        && Object.entries(this.state.paywallConfiguration).length > 0
        && (<TamediaPaywall
            isEnabled={true}
            paywallConfiguration={this.state.paywallConfiguration}
            paywallStatus={this.state.paywallStatus}
          />)
        }
      </div>
    )
  }

  componentDidMount() {
    // Get data from the Newsnet API, likely using d3-fetch
    // and set it using setState

    json(`//api-endpoint`).then(data => {
      this.setState({
        paywallConfiguration: data.paywall,
        paywallStatus: data.configs.paywall_status
      })
    }
  }
}

In-App Behaviour

This component tracks the URL of the project. In case the appwebview query parameter is present, the component will not render the paywall, is in this case this should be handled by the app itself.

Documentation

Can be found here.

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

4 years ago

2.0.7-alpha.80

4 years ago

2.1.0

4 years ago

2.0.7-alpha.79

4 years ago

2.0.7

4 years ago

2.0.7-alpha.9

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago