freemium-survey-components 1.0.91 → 1.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,27 @@
1
1
  name: Playwright Tests
2
2
  on:
3
3
  push:
4
- branches: [ main, master ]
4
+ branches: [main, master]
5
5
  pull_request:
6
- branches: [ main, master ]
6
+ branches: [main, master]
7
7
  jobs:
8
8
  test:
9
9
  timeout-minutes: 60
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v2
13
- - uses: actions/setup-node@v2
14
- with:
15
- node-version: '14.x'
16
- - name: Install dependencies
17
- run: yarn
18
- - name: Install Playwright Browsers
19
- run: npx playwright install --with-deps
20
- - name: Run Playwright tests
21
- run: yarn playwright test
22
- - uses: actions/upload-artifact@v2
23
- if: always()
24
- with:
25
- name: playwright-report
26
- path: playwright-report/
27
- retention-days: 30
12
+ - uses: actions/checkout@v2
13
+ - uses: actions/setup-node@v2
14
+ with:
15
+ node-version: '14.x'
16
+ - name: Install dependencies
17
+ run: yarn
18
+ - name: Install Playwright Browsers
19
+ run: npx playwright install --with-deps
20
+ - name: Run Playwright tests
21
+ run: yarn playwright test
22
+ - uses: actions/upload-artifact@v2
23
+ if: always()
24
+ with:
25
+ name: playwright-report
26
+ path: playwright-report/
27
+ retention-days: 30
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npm run check
package/README.md CHANGED
@@ -23,6 +23,7 @@ Make sure you have the below installed in your app.
23
23
  - ChannelPreview : ChannelPreviewProps
24
24
 
25
25
  ### Types
26
+
26
27
  ```
27
28
  type SurveyProps = {
28
29
  survey: SurveyType
@@ -50,9 +51,11 @@ type SurveyProps = {
50
51
  onAnsweringPrompt: (id: number) => void
51
52
  }
52
53
  ```
54
+
53
55
  ```
54
56
  type ChannelPreviewProps = SurveyProps & { channel: 'whatsapp' | 'instagram' }
55
57
  ```
58
+
56
59
  ```
57
60
  type WidgetProps = {
58
61
  survey: SurveyType
@@ -75,6 +78,7 @@ type WidgetProps = {
75
78
  onAnsweringPrompt: (id: number) => void
76
79
  }
77
80
  ```
81
+
78
82
  ```
79
83
  type RangeProps = {
80
84
  type_info: {
@@ -100,31 +104,37 @@ type RangeProps = {
100
104
 
101
105
  ### Usage
102
106
 
103
-
104
107
  ```js
105
- import {Survey} from 'freemium-survey-components'
106
- <Survey
107
- survey={surveyObjectFromSurveyServ}
108
- surveyStyle="card"
109
- onSubmit = {async function(data : {[key : string] : string | number | boolean | null | string[]},callback,status : 'PARTIAL' | 'COMPLETE') {
110
- await saveToDb(surveyFormData)
111
- if(status === 'COMPETE')
108
+ import { Survey } from 'freemium-survey-components';
109
+ <Survey
110
+ survey={surveyObjectFromSurveyServ}
111
+ surveyStyle="card"
112
+ onSubmit={async function (
113
+ data: { [key: string]: string | number | boolean | null | string[] },
114
+ callback,
115
+ status: 'PARTIAL' | 'COMPLETE',
116
+ ) {
117
+ await saveToDb(surveyFormData);
118
+ if (status === 'COMPETE')
112
119
  // callback should be executed in the caller once the save is done.
113
- callback?.()
114
- }}
115
- // this will get called for every answer selection with status = 'PARTIAL'
116
- placeholders = {{
117
- '{{account.company_name}}': 'Freshworks',
118
- '{{account.account_name}}': 'Freshworks Account',
119
- }}
120
- // placeholders to resolve against any such placeholder in question's text
121
- preview = {true}
122
- // preview true will not save the response
123
- initialPivotAnswer={null}
124
- // pass a number if pivot qn needed to be prefilled by default
125
- onAnsweringPrompt={function(id){ console.log(`Prompt ${id ? 'accepted' : 'rejected'}}`)}}
126
- />
120
+ callback?.();
121
+ }}
122
+ // this will get called for every answer selection with status = 'PARTIAL'
123
+ placeholders={{
124
+ '{{account.company_name}}': 'Freshworks',
125
+ '{{account.account_name}}': 'Freshworks Account',
126
+ }}
127
+ // placeholders to resolve against any such placeholder in question's text
128
+ preview={true}
129
+ // preview true will not save the response
130
+ initialPivotAnswer={null}
131
+ // pass a number if pivot qn needed to be prefilled by default
132
+ onAnsweringPrompt={function (id) {
133
+ console.log(`Prompt ${id ? 'accepted' : 'rejected'}}`);
134
+ }}
135
+ />;
127
136
  ```
137
+
128
138
  ```js
129
139
  import {WebInAppSurvey} from 'freemium-survey-components'
130
140
  const [isSurveyCompleted,setIsSurveyCompleted] = useState(false)
@@ -142,68 +152,68 @@ import {WebInAppSurvey} from 'freemium-survey-components'
142
152
  }}
143
153
  unsubscribeUrl={'#'}
144
154
  isSurveyCompleted={isSurveyCompleted}
145
- children={null}
146
- // if we want render with respect to the widget's fixed
155
+ children={null}
156
+ // if we want render with respect to the widget's fixed
147
157
  onAnsweringPrompt={function (id){ console.log(`Prompt ${id ? 'accepted' : 'rejected'}`)}}
148
158
  />
149
159
  ```
160
+
150
161
  ```js
151
- import {Range} from 'freemium-survey-components'
152
- <Range
153
- type_info={{
154
- type_variant: 'TEXT',
155
- scale_properties: {
156
- order: 'ascending',
157
- range: [
158
- {
159
- id: '1',
160
- label: 'detractor',
161
- min: 1,
162
- max: 2,
163
- },
164
- {
165
- id: '2',
166
- label: 'passive',
167
- min: 3,
168
- max: 4,
169
- },
170
- {
171
- id: '3',
172
- label: 'promoter',
173
- min: 5,
174
- max: 10,
175
- },
176
- ],
177
- button_style: {
178
- shape: 'rounded',
179
- type: 'highlighted',
162
+ import { Range } from 'freemium-survey-components';
163
+ <Range
164
+ type_info={{
165
+ type_variant: 'TEXT',
166
+ scale_properties: {
167
+ order: 'ascending',
168
+ range: [
169
+ {
170
+ id: '1',
171
+ label: 'detractor',
172
+ min: 1,
173
+ max: 2,
180
174
  },
181
- labels: {
182
- preference: 'edges',
183
- values: [
184
- 'Very dissatisfied',
185
- 'Very dissatisfied',
186
- 'Dissatisfied',
187
- 'Neutral',
188
- 'Satisfied',
189
- 'Dissatisfied',
190
- 'Neutral',
191
- 'Satisfied',
192
- 'Dissatisfied',
193
- 'Satisfied',
194
- ],
175
+ {
176
+ id: '2',
177
+ label: 'passive',
178
+ min: 3,
179
+ max: 4,
195
180
  },
181
+ {
182
+ id: '3',
183
+ label: 'promoter',
184
+ min: 5,
185
+ max: 10,
186
+ },
187
+ ],
188
+ button_style: {
189
+ shape: 'rounded',
190
+ type: 'highlighted',
191
+ },
192
+ labels: {
193
+ preference: 'edges',
194
+ values: [
195
+ 'Very dissatisfied',
196
+ 'Very dissatisfied',
197
+ 'Dissatisfied',
198
+ 'Neutral',
199
+ 'Satisfied',
200
+ 'Dissatisfied',
201
+ 'Neutral',
202
+ 'Satisfied',
203
+ 'Dissatisfied',
204
+ 'Satisfied',
205
+ ],
196
206
  },
207
+ },
197
208
  footer_text: 'We look forward to your feedback.',
198
- }}
199
- value={value}
200
- onChangeHandler={function(value: any) {
201
- setValue(value)
202
- }}
203
- />
209
+ }}
210
+ value={value}
211
+ onChangeHandler={function (value: any) {
212
+ setValue(value);
213
+ }}
214
+ />;
204
215
  ```
205
216
 
206
-
207
217
  ### Rules
208
218
 
209
- - Props (survey,answers) passed to Survey component and WebInAppSurvey component are cached on mount. In order to pass new value, component needs to be remounted.
219
+ - Props (survey,answers) passed to Survey component and WebInAppSurvey component are cached on mount. In order to pass new value, component needs to be remounted.