14.7.4 • Published 2 days ago

@financial-times/x-gift-article v14.7.4

Weekly downloads
259
License
ISC
Repository
-
Last release
2 days ago

x-gift-article

This module provides a gift article form. A gift article is the possibility of a subscriber to share an article with a non-subscriber using their credits. If you are B2B, you'll see the Enterprise version of gift article, which gives you a lot more credits, and which is owned by FT Professional.

Installation

This module is supported on Node 16 and is distributed on npm.

npm install --save @financial-times/x-gift-article

Styling

To get correct styling, Your app should have: o-fonts

Usage

Component provided by this module expects a map of gift article properties. They can be used with vanilla JavaScript or JSX (if you are not familiar check out WTF is JSX first). For example if you were writing your application using React you could use the component like this:

import React from 'react'
import { ShareArticleModal } from '@financial-times/x-gift-article'

// A == B == C
const a = ShareArticleModal(props)
const b = <ShareArticleModal {...props} />
const c = React.createElement(ShareArticleModal, props)

Your app should trigger the activate action to activate the gift article form when your app actually displays the form. For example, if your app is client-side rendered, you can use actionsRef to trigger this action:

import { h, Component } from '@financial-times/x-engine'
import { ShareArticleModal } from '@financial-times/x-gift-article'

class Container extends Component {
  showShareArticleModal() {
    if (this.shareArticleModalActions) {
      this.setState({ showShareArticleModal: true })

      // trigger the action
      this.shareArticleModalActions.activate()
    }
  }

  render() {
    return (
      <div>
        <button onClick={() => this.showShareArticleModal()}>Share</button>

        <div style={{ display: this.state.showShareArticleModal ? 'block' : 'none' }}>
          <ShareArticleModal
            {...this.props}
            actionsRef={(actions) => (this.shareArticleModalActions = actions)}
          />
        </div>
      </div>
    )
  }
}

For more information about triggering actions, see the x-interaction documentation.

All x- components are designed to be compatible with a variety of runtimes, not just React. Check out the x-engine documentation for a list of recommended libraries and frameworks.

Properties

PropertyTypeRequiredNote
isFreeArticleBooleanyesOnly non gift form is displayed when this value is true.
articleObjectyesMust contain id, title and url properties
nativeShareBooleannoThis is a property for App to display Native Sharing.
apiProtocolStringnoThe protocol to use when making requests to the gift article and URL shortening services. Ignored if apiDomain is not set.
apiDomainStringnoThe domain to use when making requests to the gift article and URL shortening services.
enterpriseApiBaseUrlStringnoThe base URL to use when making requests to the enterprise sharing service.
14.7.4

2 days ago

14.7.3

8 days ago

14.7.2

23 days ago

14.7.1

1 month ago

14.6.5

1 month ago

14.7.0

1 month ago

14.6.3

2 months ago

14.6.4

2 months ago

14.6.2

2 months ago

14.6.0

2 months ago

14.6.1

2 months ago

14.5.2

3 months ago

14.5.0

3 months ago

14.5.1

3 months ago

14.4.2

3 months ago

14.4.1

4 months ago

14.4.0

4 months ago

14.3.1

4 months ago

14.3.0

4 months ago

14.2.0

5 months ago

14.1.0

6 months ago

14.1.1

6 months ago

14.1.2

6 months ago

12.0.0

10 months ago

12.0.1

10 months ago

12.0.2

9 months ago

11.2.0

11 months ago

13.0.0

9 months ago

13.0.1

9 months ago

12.0.0-beta.2

11 months ago

12.0.0-beta.3

10 months ago

12.0.0-beta.1

11 months ago

12.0.1-beta.1

11 months ago

14.0.0

9 months ago

14.0.1

8 months ago

14.0.2

8 months ago

14.0.3

8 months ago

14.0.4

7 months ago

11.1.1

12 months ago

11.1.2

11 months ago

11.1.0

12 months ago

10.4.0

1 year ago

11.0.0

1 year ago

10.5.0

1 year ago

10.3.0

1 year ago

10.0.0

1 year ago

10.2.0

1 year ago

10.1.0

1 year ago

10.1.1

1 year ago

10.1.2

1 year ago

8.2.3

1 year ago

8.2.2

2 years ago

8.2.5

1 year ago

8.2.4

1 year ago

8.1.1

2 years ago

8.2.1

2 years ago

8.2.0

2 years ago

8.1.0

2 years ago

8.0.5

2 years ago

8.0.4

2 years ago

8.0.6

2 years ago

8.0.3

2 years ago

8.0.2

2 years ago

6.8.2-beta.1

2 years ago

8.0.1

2 years ago

8.0.1-beta.1

2 years ago

7.0.0

2 years ago

6.8.1

2 years ago

8.0.0

2 years ago

6.6.0

2 years ago

6.7.1

2 years ago

6.3.1

2 years ago

6.8.0

2 years ago

6.4.1

2 years ago

6.2.12

2 years ago

6.3.0

2 years ago

6.2.10

2 years ago

6.2.11

2 years ago

6.2.7

3 years ago

6.2.9

3 years ago

6.2.8

3 years ago

6.2.5

3 years ago

6.2.6

3 years ago

6.2.4

3 years ago

6.2.3

3 years ago

6.2.2

3 years ago

4.1.5

3 years ago

6.2.1

3 years ago

6.2.0

3 years ago

6.1.0

3 years ago

6.0.0

3 years ago

5.2.0

3 years ago

5.1.0

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.1.4

3 years ago

4.1.3

3 years ago

4.1.2

3 years ago

4.1.1

3 years ago

4.1.0

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.1.0

3 years ago

2.0.6

3 years ago

2.0.5

4 years ago

2.0.2

4 years ago

1.7.0

4 years ago

1.6.9

4 years ago

1.6.8

4 years ago

1.6.7

4 years ago

1.6.4

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.4

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0-beta.24

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-beta.23

4 years ago

1.0.0-beta.22

4 years ago

1.0.0-beta.21

5 years ago

1.0.0-beta.20

5 years ago

1.0.0-beta.19

5 years ago

1.0.0-beta.18

5 years ago

1.0.0-beta.17

5 years ago

1.0.0-beta.16

5 years ago

1.0.0-beta.15

5 years ago

1.0.0-beta.14

5 years ago

1.0.0-beta.13

5 years ago

1.0.0-beta.12

5 years ago

1.0.0-beta.11

5 years ago

0.0.10

5 years ago

0.0.9-app.9

5 years ago

0.0.9-app.8

5 years ago

0.0.9-app.7

5 years ago

0.0.9-app.5

6 years ago

0.0.9-app.4

6 years ago

0.0.9-app.3

6 years ago

0.0.9-app.2

6 years ago

0.0.9-app.1

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago