New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hello-customer/website-touchpoint

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hello-customer/website-touchpoint

Library for embedding Hello Customer surveys

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

HC.WebsiteSDK

Install

The recommended approach to install this package is to do it via npm with npm install @hello-customer/website-touchpoint

If You are not using npm or yarn, You have to include the script tag in your HTML code

<script src="https://unpkg.com/@hello-customer/website-touchpoint"></script>

Surveys

First You have to create UrlBuilder class which stores your survey configuration and later an appropriate survey instance can be created.

Survey Configuration

Example (es module)
import { UrlBuilder } from '@hello-customer/website-touchpoint'
const urlBuilder = new UrlBuilder({
  baseUrl: 'https://base.com',
  tenantId: 'xxx',
  touchPointId: 'zzzzz',
  language: 'EN',
  extra: {
    isPreview: true
  }
});
Example (script tag)
<script src="https://unpkg.com/@hello-customer/website-touchpoint"></script>
<script>
    const urlBuilder = new hcWebsiteTouchpoint.UrlBuilder({
      baseUrl: 'https://base.com',
      tenantId: 'xxx',
      touchPointId: 'zzzzz',
      language: 'EN',
      extra: {
        isPreview: true
      }
    });
</script>

Please consult the docs for more configuration options.


Inline survey

Example (es module)
import { UrlBuilder, InlineSurvey } from '@hello-customer/website-touchpoint'
const urlBuilder = new UrlBuilder({
  baseUrl: 'https://base.com',
  tenantId: 'xxx',
  touchPointId: 'zzzzz',
  language: 'EN',
  extra: {
    isPreview: true
  }
});
const inlineSurvey = new InlineSurvey(urlBuilder, {
  elementSelector: '#survey'
});
Example (script tag)
<script src="https://unpkg.com/@hello-customer/website-touchpoint"></script>
<script>
    const urlBuilder = new hcWebsiteTouchpoint.UrlBuilder({
      baseUrl: 'https://base.com',
      tenantId: 'xxx',
      touchPointId: 'zzzzz',
      language: 'EN',
      extra: {
        isPreview: true
      }
    });
    const inlineSurvey = new hcWebsiteTouchpoint.InlineSurvey(urlBuilder, {
      elementSelector: '#survey'
    });
</script>

Please consult the docs for more configuration options.


Modal survey

Example (es module)
import { UrlBuilder, InlineSurvey } from '@hello-customer/website-touchpoint'
const urlBuilder = new UrlBuilder({
  baseUrl: 'https://base.com',
  language: 'EN',
  tenantId: 'xxxx',
  touchPointId: 'zzz',
  extra: {
    isPreview: true
  }
});
const modalSurvey = new ModalSurvey(urlBuilder, {});
modalSurvey.show();
Example (script tag)
<script src="https://unpkg.com/@hello-customer/website-touchpoint"></script>
<script>
    const urlBuilder = new hcWebsiteTouchpoint.UrlBuilder({
      baseUrl: 'https://base.com',
      tenantId: 'xxxx',
      touchPointId: 'zzz',
      language: 'EN',
      extra: {
        isPreview: true
      }
    });
    const modalSurvey = new hcWebsiteTouchpoint.ModalSurvey(urlBuilder, {});
    modalSurvey.show();
</script>

Please consult the docs for more configuration options.

Modal structure

The structure of the modal can be described as follows:

<div class="hello-customer-modal">
  <div class="hello-customer-modal__window">
     <div class="hello-customer-modal__bar">
         <div class="hello-customer-modal__close-button">
             ICON
         </div>
     </div>
     <iframe class="hello-customer-survey__survey"></iframe>
  </div>
</div>

Provided class names are the once defined by the library itself by default, and can be overwritten using classNames property of the configuration object.

In order to modify styles attached to the modal elements using aforementioned class names, You can use modalStyle property of the configuration object,

If You want to style the modal by Yourself, You can remove all predefined style rules by setting ignoreDefaultStyles to true.

Modal styling example

The following example shows how to change the color of the modal top bar:

import { UrlBuilder, InlineSurvey } from '@hello-customer/website-touchpoint'
const urlBuilder = new UrlBuilder({...});
const modalSurvey = new ModalSurvey(urlBuilder, {
  modalStyle: {
    windowBarDivStyle: {
      backgroundColor: '#04c48e'
    }
  }
});

Other parts of the modal can be styled in the same way (any valid CSS property can be used for them).


Window survey

Example (es module)
import { UrlBuilder, WindowSurvey } from '@hello-customer/website-touchpoint'
const urlBuilder = new UrlBuilder({
  baseUrl: 'https://base.com',
  tenantId: 'xxx',
  touchPointId: 'zzzzz',
  language: 'EN',
  extra: {
    isPreview: true
  }
});
const windowSurvey = new WindowSurvey(urlBuilder, {
  openNewWindow: true
});
windowSurvey.open();
Example (script tag)
<script src="https://unpkg.com/@hello-customer/website-touchpoint"></script>
<script>
    const urlBuilder = new hcWebsiteTouchpoint.UrlBuilder({
      baseUrl: 'https://base.com',
      tenantId: 'xxx',
      touchPointId: 'zzzzz',
      language: 'EN',
      extra: {
        isPreview: true
      }
     });
     const windowSurvey = new hcWebsiteTouchpoint.WindowSurvey(urlBuilder, {
        openNewWindow: true
     });
     windowSurvey.open();
</script>

Please consult the docs for more configuration options.

Quarantine

It is possible to set a quarantine period for any survey type - once the survey is opened, it defines how many days should elapse before the survey could be shown again. Quarantine is applied per touchpoint (touchpointId).

Example (inline survey)
const inlineSurvey = new InlineSurvey(urlBuilder, {
  elementSelector: '#survey',
  quarantineConfig: {
    period: 5 // days
  }
});

FAQs

Package last updated on 02 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc