1.2.18 • Published 9 months ago

npssurvey v1.2.18

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

npssurvey

Nps Survey is a Npm library for getting survey responses back. This also has an option to deal with follow-up questions in a particular option.

Installation (npm)

Use the package manager npm to install npssurvey.

npm i npssurvey

Installation (yarn)

Use the package manager yarn to install npssurvey.

yarn add npssurvey

Usage

//The package should be imported initially
import NpsSurvey from "npssurvey";

//This is how the data to the survey form should be passed
const json = [
  {
      "_id": "place your uuid here",
      "question_type": "multiple_options",
      "question_text": "1",
      "multi_response": true,
      "options": [
          {
              "_id": "place your uuid here",
              "option_text": "a",
              "custom_attribute": []
          },
          {
              "_id": "place your uuid here",
              "option_text": "b",
              "custom_attribute": []
          },
      ]
  },
  {
      "_id": "place your uuid here",
      "question_type": "true_false",
      "question_text": "2",
      "options": [
          {
              "_id": "place your uuid here",
              "option_text": "True",
              "custom_attribute": []
          },
          {
              "_id": "place your uuid here",
              "option_text": "False",
              "custom_attribute": []
          }
      ]
  },
  {
      "_id": "place your uuid here",
      "question_type": "text_based",
      "question_text": "3",
      "is_follow_up": true,
      "options": []
  },
  {
      "_id": "place your uuid here",
      "question_type": "custom_attribute",
      "question_text": "orders",
      "selected_option": "Top 5 Orders",
      "options": [
          {
              "_id": "place your uuid here",
              "custom_attribute": [
                  {
                      "sku_name": "skuname goes here",
                      "sku_image": "image-url goes here",
                      "delivered_at": "date",
                      "_id": "place your uuid here"
                  },
                  {
                      "sku_name": "skuname goes here",
                      "sku_image": "image-url goes here",
                      "delivered_at": "date",
                      "_id": "place your uuid here"
                  },
                  
              ]
          }
      ]
  },
  {
      "_id": "place your uuid here",
      "question_type": "multiple_options",
      "question_text": "5",
      "options": [
          {
              "_id": "place your uuid here",
              "option_text": "a",
              "has_follow_up": true,
              "follow_up_question": "place your followup uuid here",
              "custom_attribute": []
          },
          {
              "_id": "place your uuid here",
              "option_text": "b",
              "has_follow_up": true,
              "follow_up_question": "place your followup uuid here",
              "custom_attribute": []
          }
      ]
  },
  {
      "_id": "place your uuid here",
      "question_type": "true_false",
      "question_text": "6",
      "is_follow_up": true,
      "options": [
          {
              "_id": "place your uuid here",
              "option_text": "True",
              "custom_attribute": []
          },
          {
              "_id": "place your uuid here",
              "option_text": "False",
              "custom_attribute": []
          }
      ]
  },
  {
      "_id": "place your uuid here",
      "question_type": "custom_attribute",
      "question_text": "skus",
      "selected_option": "Top 10 SKUs",
      "options": [
          {
              "_id": "place your uuid here",
              "custom_attribute": [
                  {
                      "sku_name": "skuname goes here",
                      "sku_image": "image-url goes here",
                      "qty": "97",
                      "_id": "place your uuid here"
                  },
                  {
                      "sku_name": "skuname goes here",
                      "sku_image": "image-url goes here",
                      "qty": "18",
                      "_id": "place your uuid here"
                  },
                  
              ]
          }
      ]
  }
];

//This is the driver code
const App = () => {
  return (
    <NpsSurvey
      Survey={json}
      surveyCompleted={(result) => {
            alert("Survey completed Successfully! Data:", result);
        }}
    />
  );
};

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

ISC

1.2.13

12 months ago

1.2.16

9 months ago

1.2.17

9 months ago

1.2.14

12 months ago

1.2.15

12 months ago

1.2.18

9 months ago

1.2.12

1 year ago

1.2.11

1 year ago

1.2.8

1 year ago

1.2.81

1 year ago

1.2.9

1 year ago

1.2.10

1 year ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.0.9

2 years ago

1.1.7

2 years ago

1.0.8

2 years ago

1.1.6

2 years ago

1.0.7

2 years ago

1.2.4

2 years ago

1.0.6

2 years ago

1.2.3

2 years ago

1.1.4

2 years ago

1.0.5

2 years ago

1.2.2

2 years ago

1.1.3

2 years ago

1.0.4

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.16

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.19

2 years ago

1.1.18

2 years ago

1.1.17

2 years ago

1.0.10

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