9.2.0 • Published 10 months ago

@hashicorp/react-consent-manager v9.2.0

Weekly downloads
2,582
License
MPL-2.0
Repository
github
Last release
10 months ago

Consent Manager

A GDPR-compliant consent manager.

Props

  • version (integer) - version number, bump up to override previous consent preferences
  • container (string) - id of container where the consent manager should live
  • companyName (string) - your company name to be inserted in various copy
  • privacyPolicyLink (string) - link to your company's privacy policy
  • segmentWriteKey (string) - your production segment write key
  • segmentServices (array of objects) - use this to override the category or description of a service provided by Segment
    • name - name of the Segment integration, must match the integration you are overriding
    • category optional - new category name
    • description optional - new description
  • categories (array) - State of toggle
    • name - name of category
    • description - description for the category
  • additionalServices (array of objects) - additional integrations outside of Segment that you wish to include in the consent manager
    • name - name of service
    • description - description of service
    • category - category of service
    • body optional - javascript body associated with service If present, overrides url below
    • url optional - url of js file associated with service
    • async (bool) optional - add async property to script element
    • addToBody (bool) optional - inject script before closing <body> tag
    • dataAttrs (arr) optional - array of data- attributes to add to script tag
      • name (str) - name of data attribute (data-name)
      • value (str) - value of data attribute to set

Upgrading from v8 to v9

npm install @hashicorp/react-consent-manager@latest

Warning: v9 is technically not a breaking change, but there are some significant changes to be aware of with regards to our analytics.

As of v9.0.0, the Segment CDN hostname has been replace with a HashiCorp hostname via analytics._cdn. A custom Segment Analytics.js URL is also being used. There is no breaking change to the react component API.

SegmentPreloadScript

In v9.0.0, ConsentManager now exports a SegmentPreloadScript component. Why? ConsentManager uses a very similar Segment script to the current preloading script that we use in our _document.tsx/js files.

Now that we're updating both with a custom Segment AJS URL and CDN hostname, it makes sense for the two to be co-located.

Expect the new change to look like the following:

// pages/_document.tsx


  import Document, { Html, Head, Main, NextScript } from 'next/document'
  import HashiHead from '@hashicorp/react-head'
+ import { SegmentPreloadScript } from '@hashicorp/react-consent-manager/scripts/segment'
  // other imports

  export default class MyDocument extends Document {
    static async getInitialProps(ctx) {
      const initialProps = await Document.getInitialProps(ctx)
      return { ...initialProps }
    }

    render() {
      return (
        <Html lang="en">
          <Head>
            <HashiHead />
          </Head>
          <body>
-           <script
-             dangerouslySetInnerHTML={{
-               __html: `!function(){var analytics=window... ... ...`
-             }}
-           />
+           <SegmentPreloadScript />

// etc...

No additional updates are necessary!

9.2.0

10 months ago

9.1.2

11 months ago

9.1.1

12 months ago

9.1.0

1 year ago

9.0.2

1 year ago

8.2.2

1 year ago

9.0.1

1 year ago

9.0.0

1 year ago

8.2.1

1 year ago

8.1.0

2 years ago

8.2.0

2 years ago

7.3.0

2 years ago

7.4.1

2 years ago

7.4.0

2 years ago

7.5.0

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

7.2.0

2 years ago

7.1.3

2 years ago

7.1.2

2 years ago

7.1.1

2 years ago

7.1.0

2 years ago

7.0.3

3 years ago

7.0.2

3 years ago

7.0.1

3 years ago

7.0.0

3 years ago

6.0.3

3 years ago

6.0.2

3 years ago

6.0.1

3 years ago

5.3.3-alpha.14

3 years ago

6.0.0

3 years ago

5.3.2

3 years ago

5.3.1

3 years ago

5.3.0

3 years ago

5.1.1-alpha.10

3 years ago

5.1.1-alpha.16

3 years ago

5.2.0

3 years ago

5.1.0

3 years ago

5.0.0

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.0.5-next.49

3 years ago

3.0.5-alpha.43

3 years ago

3.0.5-pr170.43

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

2.1.9

4 years ago

2.1.10

4 years ago

3.0.0

4 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.1-alpha.3

4 years ago

2.1.1-alpha.2

4 years ago

2.1.1-alpha.1

4 years ago

2.1.0

4 years ago

2.0.11-alpha.3

4 years ago

2.0.10

4 years ago

2.0.11-alpha.2

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.5-alpha.0

4 years ago

2.0.4-alpha.0

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

5 years ago

1.1.17-fonts.0

5 years ago

1.1.16-fonts.0

5 years ago

1.1.15-fonts.0

5 years ago

1.1.14-fonts.0

5 years ago

1.1.13-fonts.0

5 years ago

1.1.12-fonts.0

5 years ago

1.1.11-fonts.0

5 years ago

1.1.10-fonts.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.1.9-fonts.0

5 years ago

1.1.8-fonts.0

5 years ago

1.1.7-fonts.0

5 years ago

1.1.6-fonts.0

5 years ago

1.1.5-fonts.0

5 years ago

1.1.4-fonts.0

5 years ago

1.1.3-fonts.0

5 years ago

1.1.2-fonts.0

5 years ago

1.1.1-fonts.0

5 years ago

1.1.0-fonts.0

5 years ago

1.0.5-fonts.0

5 years ago

1.0.4-fonts.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago