3.1.3 • Published 17 days ago

peel-dashboard-kit v3.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
17 days ago

npm version code style: prettier

Peel Dashboard Kit

Library for embedding Peel's dashboard in third party applications.

Prerequisites

This project requires NodeJS (version 8 or later) and NPM. You can install them from here Node and NPM.

To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v
6.4.1
v8.16.0

React >=16 is also needed.

Installation

$ cd PROJECT
$ npm i peel-dashboard-kit

Usage

Example with custom columns layout:

import { PeelDashboard } from 'peel-dashboard-kit'

const App = () => {
  return (
    <div className="App">
      <PeelDashboard
        dashboardID="f123d932215e74e2b6dcfdf710be923f1eda9a8d"
        studyID="43"
        token={/* YOUR_PEEL_DASHBOARD_TOKEN */}
      />
    </div>
  );
};

Peel dashboard kit props

/*
  ID of the dashboard that is being shown
*/
dashboardID: string = ''

/*
  ID of the study the dashboard belongs to
*/
studyID: string = ''

/*
  base url for api requests (token has to be generated for the particular host)
*/
host?: string = 'https://app.peelinsights.com'

/*
  grouping string that specifies the grouping option for the dashboard. Useful when grouping is selected outside the peel dashboard component
*/
goruping?: string: DAY | WEEK | MONTH | QUARTERLY | YEAR | WEEKDAY | ROLLING_7DAY | ROLLING_30DAY | ROLLING_6WEEK | WEEK_TO_DATE | MONTH_TO_DATE | QUARTER_TO_DATE | YEAR_TO_DATE | PACING.

/*
  An array string with start and end dates to filter the information from the dashboard.
  format: YYYY-MM-DD
  e.g.: ['2023-10-01', '2023-12-01']
*/
customDatesRange?: Array<string> = false;

/*
  This prop enables showing the filters on the dashboard.
  Filters include a datepicker and a time grouping.
*/
showFilters?: boolean = false;

/*
  This prop enables showing the header of the dashboard,
  which displays the dashboard name and the description.
*/
showHeader?: boolean = false;

/*
  If set to true, it shows the read only version of a dashboard.
  It hides the edit widget button on hover.
*/
isReadOnly?: boolean = false;

/*
  If set to true, it shows a spinner indicator.
*/
isLoading?: boolean = false;

/*
  flag that tells the peel dashboard kit when to go fetch multi metric widget information again.
  When set to true it fetches the multi metric widget information again.
  Useful when stats are added/removed from the outside and we need to update the widget without having to refresh the page
*/
reloadMultiline?: boolean = false

/*
  This prop sets the rowHeight of react-grid-layout.
  refer to https://github.com/react-grid-layout/react-grid-layout
*/
rowHeight?: number = 150;

/*
  Margin between items [x, y] in px.
  refer to https://github.com/react-grid-layout/react-grid-layout
*/
margin: ?[number, number] = [10, 10]


// Number of columns in this layout.
// refer to https://github.com/react-grid-layout/react-grid-layout
cols: ?number = 12,

/*
  Theme prop currently support 'default' theme which has the look and feel of Peel, and the 'polaris' theme which has the shopify polaris look and feel
*/
theme?: string = 'default'

/*
  chartColors prop is an array of strings that accepts n colors for the different segments of the charts
*/
chartColors?: Array<string> = 'https://app.peelinsights.com'

/*
  If set to true, it shows headlines on each widget. If set to false it only shows the descriptions.
*/
showInsightsAndAnnotations?: boolean = false

/*
  Callback function when the edit widget button is clicked.
  widget: widget information of the current widget on which the user clicked the edit button
  callback: callback function that the user can execute once edition has been made on the widget. It expects either newWidget information
  or newLayout information. (newWidget, newLayout) => void
*/
onEditWidget?: (widget, callback) => void

/*
  Callback function when the user clicks on "Ask Differently" button. This happens when the AI couldn't generate a response for a query.
  It sends the newQuery string, which is the new query/question the user is asking.
*/
onAskDifferently?: (newQuery: string) => void

/*
  Callback function that executes when the user clicks "Talk to Human" button when the AI couldn't create a response for the query.
  e.g. you can open up intercom chat on this callback
*/
onTalkToHuman?: () => void

Run storybook

npm run storybook

Deploy a new version to npm

Create locally the dist folder which gets published to npm

npm run build-lib

Publish the new version to npm

npm publish

Test new version locally (without publishing it to npm)

Create locally the dist folder which gets published to npm

npm run build-lib

Create .tgz file on the destination project/folder. This creates a .tgz file in the destination folder that exists in the create-pack script. You might to change that destination folder to match your own local folder.

npm run create-pack

Install the version inside the project

Once you created the tgz file, make sure to change the peel-dashboard-kit reference in the package.json to point to that file.

// package.json
//...
"peel-dashboard-kit": "file:peel-dashboard-kit@3.0.34.tgz"
//...

Then run:

npm install

Note on React 18 and strict mode.

google-map-react has a known bug when using React 18 and strict mode.

We use google-map-react to display the audience widget on dashboards.

A workaround to make the audience widget work on React 18 is to disable strict mode by removing <React.StrictMode>...</React.StrictMode>

License

MIT License

3.1.3

17 days ago

3.1.2

2 months ago

3.1.1

2 months ago

3.1.0

2 months ago

3.0.34

3 months ago

3.0.33

3 months ago

3.0.32

4 months ago

3.0.31

4 months ago

3.0.30

4 months ago

3.0.28

4 months ago

3.0.29

4 months ago

3.0.27

4 months ago

3.0.26

4 months ago

3.0.24

4 months ago

3.0.25

4 months ago

3.0.23

4 months ago

3.0.22

5 months ago

3.0.21

5 months ago

3.0.20

5 months ago

3.0.18

5 months ago

3.0.19

5 months ago

3.0.13

5 months ago

3.0.16

5 months ago

3.0.17

5 months ago

3.0.14

5 months ago

3.0.15

5 months ago

2.2.1

7 months ago

2.2.0

7 months ago

2.2.3

7 months ago

2.2.2

7 months ago

2.2.5

7 months ago

2.2.4

7 months ago

2.2.7

7 months ago

2.2.6

7 months ago

3.0.4

5 months ago

3.0.3

5 months ago

3.0.2

5 months ago

3.0.1

5 months ago

3.0.8

5 months ago

3.0.7

5 months ago

3.0.6

5 months ago

3.0.5

5 months ago

3.0.0

5 months ago

3.0.9

5 months ago

2.2.9

7 months ago

2.2.8

7 months ago

3.0.12

5 months ago

3.0.10

5 months ago

3.0.11

5 months ago

2.2.17

7 months ago

2.2.18

6 months ago

2.2.15

7 months ago

2.2.16

7 months ago

2.2.13

7 months ago

2.2.14

7 months ago

2.2.11

7 months ago

2.2.12

7 months ago

2.2.10

7 months ago

2.2.19

6 months ago

2.2.28

6 months ago

2.2.29

6 months ago

2.2.26

6 months ago

2.2.27

6 months ago

2.2.24

6 months ago

2.2.25

6 months ago

2.2.22

6 months ago

2.2.23

6 months ago

2.2.20

6 months ago

2.2.21

6 months ago

2.2.39

5 months ago

2.2.37

5 months ago

2.2.38

5 months ago

2.2.35

6 months ago

2.2.36

6 months ago

2.2.33

6 months ago

2.2.34

6 months ago

2.2.31

6 months ago

2.2.32

6 months ago

2.2.30

6 months ago

2.2.40

5 months ago

2.2.41

5 months ago

1.3.8

7 months ago

2.1.28

8 months ago

2.1.29

8 months ago

2.1.36

7 months ago

2.1.37

7 months ago

2.1.34

7 months ago

2.1.35

7 months ago

2.1.32

8 months ago

2.1.33

7 months ago

2.1.30

8 months ago

2.1.31

8 months ago

2.0.3

10 months ago

2.0.2

10 months ago

2.0.5

10 months ago

2.0.7

10 months ago

2.0.6

10 months ago

2.0.9

10 months ago

2.0.8

10 months ago

2.0.1

10 months ago

2.0.0

10 months ago

2.1.9

9 months ago

2.1.16

9 months ago

2.1.17

9 months ago

2.1.14

9 months ago

2.1.15

9 months ago

2.1.12

9 months ago

2.1.13

9 months ago

2.1.10

9 months ago

2.1.11

9 months ago

2.1.18

8 months ago

2.1.19

8 months ago

2.1.27

8 months ago

2.1.25

8 months ago

2.1.26

8 months ago

2.1.23

8 months ago

2.1.24

8 months ago

2.1.21

8 months ago

2.1.22

8 months ago

2.1.20

8 months ago

1.3.7

9 months ago

1.3.6

11 months ago

1.3.5

11 months ago

2.1.2

10 months ago

2.1.1

10 months ago

2.1.4

9 months ago

2.0.13

10 months ago

2.1.3

9 months ago

2.1.6

9 months ago

2.0.11

10 months ago

2.1.5

9 months ago

2.0.12

10 months ago

2.1.8

9 months ago

2.1.7

9 months ago

2.0.10

10 months ago

2.1.0

10 months ago

1.3.4

12 months ago

1.3.3

1 year ago

1.2.0

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.1

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.0.80

1 year ago

1.0.83

1 year ago

1.0.82

1 year ago

1.0.81

1 year ago

1.0.88

1 year ago

1.0.87

1 year ago

1.0.86

1 year ago

1.0.85

1 year ago

1.0.89

1 year ago

1.0.91

1 year ago

1.0.90

1 year ago

1.0.95

1 year ago

1.0.94

1 year ago

1.0.93

1 year ago

1.0.92

1 year ago

1.0.79

1 year ago

1.0.78

1 year ago

1.0.76

1 year ago

1.0.75

1 year ago

1.0.74

1 year ago

1.0.73

1 year ago

1.0.72

1 year ago

1.0.71

1 year ago

1.0.70

1 year ago

1.0.69

1 year ago

1.0.68

1 year ago

1.0.67

1 year ago

1.0.66

1 year ago

1.0.65

1 year ago

1.0.64

1 year ago

1.0.63

1 year ago

1.0.62

1 year ago

1.0.61

1 year ago

1.0.60

1 year ago

1.0.59

1 year ago

1.0.58

1 year ago

1.0.57

1 year ago

1.0.56

1 year ago

1.0.55

1 year ago

1.0.54

1 year ago

1.0.53

1 year ago

1.0.52

1 year ago

1.0.51

1 year ago

1.0.50

1 year ago

1.0.49

1 year ago

1.0.48

1 year ago

1.0.47

1 year ago

1.0.46

1 year ago

1.0.45

1 year ago

1.0.44

1 year ago

1.0.43

1 year ago

1.0.42

1 year ago

1.0.41

1 year ago

1.0.40

1 year ago

1.0.39

1 year ago

1.0.38

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago