@screeb/sdk-react 0.1.1 → 0.1.3
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.
- package/dist/es/index.js +14 -20
- package/dist/es/types.d.ts +3 -1
- package/docs/README.md +115 -114
- package/package.json +21 -21
package/dist/es/index.js
CHANGED
|
@@ -16,20 +16,9 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
16
16
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
17
|
PERFORMANCE OF THIS SOFTWARE.
|
|
18
18
|
***************************************************************************** */
|
|
19
|
-
/* global Reflect, Promise */
|
|
19
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var __assign = function() {
|
|
23
|
-
__assign = Object.assign || function __assign(t) {
|
|
24
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
25
|
-
s = arguments[i];
|
|
26
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
27
|
-
}
|
|
28
|
-
return t;
|
|
29
|
-
};
|
|
30
|
-
return __assign.apply(this, arguments);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
22
|
function __rest(s, e) {
|
|
34
23
|
var t = {};
|
|
35
24
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -78,7 +67,12 @@ function __generator(thisArg, body) {
|
|
|
78
67
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
79
68
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
80
69
|
}
|
|
81
|
-
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
73
|
+
var e = new Error(message);
|
|
74
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
75
|
+
};
|
|
82
76
|
|
|
83
77
|
var ScreebContext = React.createContext(undefined);
|
|
84
78
|
|
|
@@ -113,7 +107,7 @@ var isSSR = typeof window === "undefined";
|
|
|
113
107
|
|
|
114
108
|
var isInitialized = false;
|
|
115
109
|
var ScreebProvider = function (_a) {
|
|
116
|
-
var websiteId = _a.websiteId, userId = _a.userId, userProperties = _a.userProperties, children = _a.children, _b = _a.shouldLoad, shouldLoad = _b === void 0 ? !isSSR : _b, _c = _a.autoInit, autoInit = _c === void 0 ? false : _c, options = _a.options, rest = __rest(_a, ["websiteId", "userId", "userProperties", "children", "shouldLoad", "autoInit", "options"]);
|
|
110
|
+
var websiteId = _a.websiteId, userId = _a.userId, userProperties = _a.userProperties, hooks = _a.hooks, children = _a.children, _b = _a.shouldLoad, shouldLoad = _b === void 0 ? !isSSR : _b, _c = _a.autoInit, autoInit = _c === void 0 ? false : _c, options = _a.options, rest = __rest(_a, ["websiteId", "userId", "userProperties", "hooks", "children", "shouldLoad", "autoInit", "options"]);
|
|
117
111
|
var isLoaded = React.useRef(Screeb.isLoaded());
|
|
118
112
|
// Allow data-x attributes, see https://github.com/devrnt/react-use-screeb/issues/478
|
|
119
113
|
var invalidPropKeys = Object.keys(rest).filter(function (key) { return !key.startsWith("data-"); });
|
|
@@ -230,12 +224,12 @@ var ScreebProvider = function (_a) {
|
|
|
230
224
|
case 1: return [2 /*return*/, _a.sent()];
|
|
231
225
|
}
|
|
232
226
|
}); }); }, []);
|
|
233
|
-
var init = React.useCallback(function (websiteId, userId, userProperties) { return __awaiter(void 0, void 0, void 0, function () {
|
|
227
|
+
var init = React.useCallback(function (websiteId, userId, userProperties, hooks) { return __awaiter(void 0, void 0, void 0, function () {
|
|
234
228
|
return __generator(this, function (_a) {
|
|
235
229
|
switch (_a.label) {
|
|
236
230
|
case 0: return [4 /*yield*/, ensureScreeb("init", function () {
|
|
237
231
|
if (!isInitialized) {
|
|
238
|
-
Screeb.init(websiteId, userId, userProperties);
|
|
232
|
+
Screeb.init(websiteId, userId, userProperties, hooks);
|
|
239
233
|
isInitialized = true;
|
|
240
234
|
}
|
|
241
235
|
}, true)];
|
|
@@ -254,7 +248,7 @@ var ScreebProvider = function (_a) {
|
|
|
254
248
|
isLoaded.current = true;
|
|
255
249
|
if (!autoInit) return [3 /*break*/, 3];
|
|
256
250
|
if (!websiteId) return [3 /*break*/, 2];
|
|
257
|
-
return [4 /*yield*/, init(websiteId, userId, userProperties)];
|
|
251
|
+
return [4 /*yield*/, init(websiteId, userId, userProperties, hooks)];
|
|
258
252
|
case 1:
|
|
259
253
|
_a.sent();
|
|
260
254
|
return [3 /*break*/, 3];
|
|
@@ -271,11 +265,11 @@ var ScreebProvider = function (_a) {
|
|
|
271
265
|
case 1: return [2 /*return*/, _a.sent()];
|
|
272
266
|
}
|
|
273
267
|
}); }); }, []);
|
|
274
|
-
var surveyStart = React.useCallback(function (surveyId, allowMultipleResponses, hiddenFields) { return __awaiter(void 0, void 0, void 0, function () {
|
|
268
|
+
var surveyStart = React.useCallback(function (surveyId, allowMultipleResponses, hiddenFields, hooks) { return __awaiter(void 0, void 0, void 0, function () {
|
|
275
269
|
return __generator(this, function (_a) {
|
|
276
270
|
switch (_a.label) {
|
|
277
271
|
case 0: return [4 /*yield*/, ensureScreeb("surveyStart", function () {
|
|
278
|
-
return Screeb.surveyStart(surveyId, allowMultipleResponses, hiddenFields);
|
|
272
|
+
return Screeb.surveyStart(surveyId, allowMultipleResponses, hiddenFields, hooks);
|
|
279
273
|
})];
|
|
280
274
|
case 1: return [2 /*return*/, _a.sent()];
|
|
281
275
|
}
|
|
@@ -329,7 +323,7 @@ var ScreebProvider = function (_a) {
|
|
|
329
323
|
if (!isSSR && shouldLoad) {
|
|
330
324
|
load(options);
|
|
331
325
|
}
|
|
332
|
-
return (jsx(ScreebContext.Provider,
|
|
326
|
+
return (jsx(ScreebContext.Provider, { value: providerValue, children: children }));
|
|
333
327
|
};
|
|
334
328
|
var useScreebContext = function () {
|
|
335
329
|
var context = React.useContext(ScreebContext);
|
package/dist/es/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "@screeb/sdk-browser";
|
|
1
|
+
import { Hooks, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "@screeb/sdk-browser";
|
|
2
2
|
/** Properties of Screeb provider */
|
|
3
3
|
export type ScreebProps = {
|
|
4
4
|
/** Your website/channel id. */
|
|
@@ -7,6 +7,8 @@ export type ScreebProps = {
|
|
|
7
7
|
userId?: string;
|
|
8
8
|
/** The properties of your user. */
|
|
9
9
|
userProperties?: PropertyRecord;
|
|
10
|
+
/** Hooks to define callback for various event */
|
|
11
|
+
hooks?: Hooks;
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
12
14
|
* Shutdowns current Screeb session.
|
package/docs/README.md
CHANGED
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
|
|
43
43
|
Shutdowns current Screeb session.
|
|
44
44
|
|
|
45
|
+
##### Returns
|
|
46
|
+
|
|
47
|
+
`Promise`<`void`\>
|
|
48
|
+
|
|
45
49
|
**`Example`**
|
|
46
50
|
|
|
47
51
|
```ts
|
|
@@ -50,10 +54,6 @@ const { close } = useScreeb();
|
|
|
50
54
|
close();
|
|
51
55
|
```
|
|
52
56
|
|
|
53
|
-
##### Returns
|
|
54
|
-
|
|
55
|
-
`Promise`<`void`\>
|
|
56
|
-
|
|
57
57
|
___
|
|
58
58
|
|
|
59
59
|
### DebugFunction
|
|
@@ -66,6 +66,10 @@ ___
|
|
|
66
66
|
|
|
67
67
|
Prints the actual state information of Screeb tag.
|
|
68
68
|
|
|
69
|
+
##### Returns
|
|
70
|
+
|
|
71
|
+
`Promise`<`unknown`\>
|
|
72
|
+
|
|
69
73
|
**`Example`**
|
|
70
74
|
|
|
71
75
|
```ts
|
|
@@ -91,10 +95,6 @@ debug();
|
|
|
91
95
|
// **************************************************************
|
|
92
96
|
```
|
|
93
97
|
|
|
94
|
-
##### Returns
|
|
95
|
-
|
|
96
|
-
`Promise`<`unknown`\>
|
|
97
|
-
|
|
98
98
|
___
|
|
99
99
|
|
|
100
100
|
### EventTrackFunction
|
|
@@ -107,6 +107,17 @@ ___
|
|
|
107
107
|
|
|
108
108
|
Tracks a user event.
|
|
109
109
|
|
|
110
|
+
##### Parameters
|
|
111
|
+
|
|
112
|
+
| Name | Type | Description |
|
|
113
|
+
| :------ | :------ | :------ |
|
|
114
|
+
| `eventName` | `string` | The event name. |
|
|
115
|
+
| `eventProperties?` | `PropertyRecord` | The properties of your event. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
116
|
+
|
|
117
|
+
##### Returns
|
|
118
|
+
|
|
119
|
+
`Promise`<`unknown`\>
|
|
120
|
+
|
|
110
121
|
**`Example`**
|
|
111
122
|
|
|
112
123
|
```ts
|
|
@@ -128,17 +139,6 @@ eventTrack(
|
|
|
128
139
|
);
|
|
129
140
|
```
|
|
130
141
|
|
|
131
|
-
##### Parameters
|
|
132
|
-
|
|
133
|
-
| Name | Type | Description |
|
|
134
|
-
| :------ | :------ | :------ |
|
|
135
|
-
| `eventName` | `string` | The event name. |
|
|
136
|
-
| `eventProperties?` | `PropertyRecord` | The properties of your event. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
137
|
-
|
|
138
|
-
##### Returns
|
|
139
|
-
|
|
140
|
-
`Promise`<`unknown`\>
|
|
141
|
-
|
|
142
142
|
___
|
|
143
143
|
|
|
144
144
|
### IdentityFunction
|
|
@@ -152,6 +152,17 @@ ___
|
|
|
152
152
|
Change the current user identity.
|
|
153
153
|
Warning: Running surveys will be closed.
|
|
154
154
|
|
|
155
|
+
##### Parameters
|
|
156
|
+
|
|
157
|
+
| Name | Type | Description |
|
|
158
|
+
| :------ | :------ | :------ |
|
|
159
|
+
| `userId` | `string` | The unique identifier of your user. |
|
|
160
|
+
| `userProperties?` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
161
|
+
|
|
162
|
+
##### Returns
|
|
163
|
+
|
|
164
|
+
`Promise`<`unknown`\>
|
|
165
|
+
|
|
155
166
|
**`Example`**
|
|
156
167
|
|
|
157
168
|
```ts
|
|
@@ -169,17 +180,6 @@ identity(
|
|
|
169
180
|
);
|
|
170
181
|
```
|
|
171
182
|
|
|
172
|
-
##### Parameters
|
|
173
|
-
|
|
174
|
-
| Name | Type | Description |
|
|
175
|
-
| :------ | :------ | :------ |
|
|
176
|
-
| `userId` | `string` | The unique identifier of your user. |
|
|
177
|
-
| `userProperties?` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
178
|
-
|
|
179
|
-
##### Returns
|
|
180
|
-
|
|
181
|
-
`Promise`<`unknown`\>
|
|
182
|
-
|
|
183
183
|
___
|
|
184
184
|
|
|
185
185
|
### IdentityGetFunction
|
|
@@ -192,6 +192,10 @@ ___
|
|
|
192
192
|
|
|
193
193
|
Retrieves the current user identity.
|
|
194
194
|
|
|
195
|
+
##### Returns
|
|
196
|
+
|
|
197
|
+
`Promise`<`ScreebIdentityGetReturn`\>
|
|
198
|
+
|
|
195
199
|
**`Example`**
|
|
196
200
|
|
|
197
201
|
```ts
|
|
@@ -209,10 +213,6 @@ console.log(await identityGet());
|
|
|
209
213
|
// }
|
|
210
214
|
```
|
|
211
215
|
|
|
212
|
-
##### Returns
|
|
213
|
-
|
|
214
|
-
`Promise`<`ScreebIdentityGetReturn`\>
|
|
215
|
-
|
|
216
216
|
___
|
|
217
217
|
|
|
218
218
|
### IdentityGroupAssignFunction
|
|
@@ -225,6 +225,18 @@ ___
|
|
|
225
225
|
|
|
226
226
|
Assigns the current user to a group.
|
|
227
227
|
|
|
228
|
+
##### Parameters
|
|
229
|
+
|
|
230
|
+
| Name | Type | Description |
|
|
231
|
+
| :------ | :------ | :------ |
|
|
232
|
+
| `groupName` | `string` | |
|
|
233
|
+
| `groupType?` | `string` | |
|
|
234
|
+
| `groupProperties?` | `PropertyRecord` | The properties of your user group. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
235
|
+
|
|
236
|
+
##### Returns
|
|
237
|
+
|
|
238
|
+
`Promise`<`unknown`\>
|
|
239
|
+
|
|
228
240
|
**`Example`**
|
|
229
241
|
|
|
230
242
|
```ts
|
|
@@ -244,18 +256,6 @@ identityGroupAssign(
|
|
|
244
256
|
);
|
|
245
257
|
```
|
|
246
258
|
|
|
247
|
-
##### Parameters
|
|
248
|
-
|
|
249
|
-
| Name | Type | Description |
|
|
250
|
-
| :------ | :------ | :------ |
|
|
251
|
-
| `groupName` | `string` | |
|
|
252
|
-
| `groupType?` | `string` | |
|
|
253
|
-
| `groupProperties?` | `PropertyRecord` | The properties of your user group. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
254
|
-
|
|
255
|
-
##### Returns
|
|
256
|
-
|
|
257
|
-
`Promise`<`unknown`\>
|
|
258
|
-
|
|
259
259
|
___
|
|
260
260
|
|
|
261
261
|
### IdentityGroupUnassignFunction
|
|
@@ -268,14 +268,6 @@ ___
|
|
|
268
268
|
|
|
269
269
|
Unassigns the current user to a group.
|
|
270
270
|
|
|
271
|
-
**`Example`**
|
|
272
|
-
|
|
273
|
-
```ts
|
|
274
|
-
const { identityGroupUnassign } = useScreeb();
|
|
275
|
-
|
|
276
|
-
identityGroupUnassign('company', 'Apple');
|
|
277
|
-
```
|
|
278
|
-
|
|
279
271
|
##### Parameters
|
|
280
272
|
|
|
281
273
|
| Name | Type | Description |
|
|
@@ -287,6 +279,14 @@ identityGroupUnassign('company', 'Apple');
|
|
|
287
279
|
|
|
288
280
|
`Promise`<`unknown`\>
|
|
289
281
|
|
|
282
|
+
**`Example`**
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
const { identityGroupUnassign } = useScreeb();
|
|
286
|
+
|
|
287
|
+
identityGroupUnassign('company', 'Apple');
|
|
288
|
+
```
|
|
289
|
+
|
|
290
290
|
___
|
|
291
291
|
|
|
292
292
|
### IdentityPropertiesFunction
|
|
@@ -299,6 +299,16 @@ ___
|
|
|
299
299
|
|
|
300
300
|
Adds properties to the current user identity.
|
|
301
301
|
|
|
302
|
+
##### Parameters
|
|
303
|
+
|
|
304
|
+
| Name | Type | Description |
|
|
305
|
+
| :------ | :------ | :------ |
|
|
306
|
+
| `userProperties` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
307
|
+
|
|
308
|
+
##### Returns
|
|
309
|
+
|
|
310
|
+
`Promise`<`unknown`\>
|
|
311
|
+
|
|
302
312
|
**`Example`**
|
|
303
313
|
|
|
304
314
|
```ts
|
|
@@ -325,16 +335,6 @@ identityProperties(
|
|
|
325
335
|
);
|
|
326
336
|
```
|
|
327
337
|
|
|
328
|
-
##### Parameters
|
|
329
|
-
|
|
330
|
-
| Name | Type | Description |
|
|
331
|
-
| :------ | :------ | :------ |
|
|
332
|
-
| `userProperties` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
333
|
-
|
|
334
|
-
##### Returns
|
|
335
|
-
|
|
336
|
-
`Promise`<`unknown`\>
|
|
337
|
-
|
|
338
338
|
___
|
|
339
339
|
|
|
340
340
|
### IdentityResetFunction
|
|
@@ -348,6 +348,10 @@ ___
|
|
|
348
348
|
Resets the current user identity.
|
|
349
349
|
Warning: This command must be called only once, since it creates a new identity on Screeb side.
|
|
350
350
|
|
|
351
|
+
##### Returns
|
|
352
|
+
|
|
353
|
+
`Promise`<`unknown`\>
|
|
354
|
+
|
|
351
355
|
**`Example`**
|
|
352
356
|
|
|
353
357
|
```ts
|
|
@@ -356,10 +360,6 @@ const { identityReset } = useScreeb();
|
|
|
356
360
|
identityReset();
|
|
357
361
|
```
|
|
358
362
|
|
|
359
|
-
##### Returns
|
|
360
|
-
|
|
361
|
-
`Promise`<`unknown`\>
|
|
362
|
-
|
|
363
363
|
___
|
|
364
364
|
|
|
365
365
|
### InitFunction
|
|
@@ -372,6 +372,18 @@ ___
|
|
|
372
372
|
|
|
373
373
|
Initializes Screeb tag.
|
|
374
374
|
|
|
375
|
+
##### Parameters
|
|
376
|
+
|
|
377
|
+
| Name | Type | Description |
|
|
378
|
+
| :------ | :------ | :------ |
|
|
379
|
+
| `websiteId` | `string` | Your website/channel id. |
|
|
380
|
+
| `userId?` | `string` | The unique identifier of your user. |
|
|
381
|
+
| `userProperties?` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date ``` |
|
|
382
|
+
|
|
383
|
+
##### Returns
|
|
384
|
+
|
|
385
|
+
`Promise`<`void`\>
|
|
386
|
+
|
|
375
387
|
**`Example`**
|
|
376
388
|
|
|
377
389
|
```ts
|
|
@@ -390,18 +402,6 @@ init(
|
|
|
390
402
|
);
|
|
391
403
|
```
|
|
392
404
|
|
|
393
|
-
##### Parameters
|
|
394
|
-
|
|
395
|
-
| Name | Type | Description |
|
|
396
|
-
| :------ | :------ | :------ |
|
|
397
|
-
| `websiteId` | `string` | Your website/channel id. |
|
|
398
|
-
| `userId?` | `string` | The unique identifier of your user. |
|
|
399
|
-
| `userProperties?` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date ``` |
|
|
400
|
-
|
|
401
|
-
##### Returns
|
|
402
|
-
|
|
403
|
-
`Promise`<`void`\>
|
|
404
|
-
|
|
405
405
|
___
|
|
406
406
|
|
|
407
407
|
### LoadFunction
|
|
@@ -414,14 +414,6 @@ ___
|
|
|
414
414
|
|
|
415
415
|
Appends Screeb tag into your dom.
|
|
416
416
|
|
|
417
|
-
**`Example`**
|
|
418
|
-
|
|
419
|
-
```ts
|
|
420
|
-
const { load } = useScreeb();
|
|
421
|
-
|
|
422
|
-
load();
|
|
423
|
-
```
|
|
424
|
-
|
|
425
417
|
##### Parameters
|
|
426
418
|
|
|
427
419
|
| Name | Type | Description |
|
|
@@ -432,6 +424,14 @@ load();
|
|
|
432
424
|
|
|
433
425
|
`Promise`<`void`\>
|
|
434
426
|
|
|
427
|
+
**`Example`**
|
|
428
|
+
|
|
429
|
+
```ts
|
|
430
|
+
const { load } = useScreeb();
|
|
431
|
+
|
|
432
|
+
load();
|
|
433
|
+
```
|
|
434
|
+
|
|
435
435
|
___
|
|
436
436
|
|
|
437
437
|
### ScreebContextValues
|
|
@@ -472,6 +472,7 @@ Properties of Screeb provider
|
|
|
472
472
|
|
|
473
473
|
| Name | Type | Description |
|
|
474
474
|
| :------ | :------ | :------ |
|
|
475
|
+
| `hooks?` | `Hooks` | Hooks to define callback for various event |
|
|
475
476
|
| `userId?` | `string` | The unique identifier of your user. |
|
|
476
477
|
| `userProperties?` | `PropertyRecord` | The properties of your user. |
|
|
477
478
|
| `websiteId` | `string` | Your website/channel id. |
|
|
@@ -496,6 +497,10 @@ ___
|
|
|
496
497
|
|
|
497
498
|
Interrupts a running survey.
|
|
498
499
|
|
|
500
|
+
##### Returns
|
|
501
|
+
|
|
502
|
+
`Promise`<`unknown`\>
|
|
503
|
+
|
|
499
504
|
**`Example`**
|
|
500
505
|
|
|
501
506
|
```ts
|
|
@@ -504,10 +509,6 @@ const { surveyClose } = useScreeb();
|
|
|
504
509
|
surveyClose();
|
|
505
510
|
```
|
|
506
511
|
|
|
507
|
-
##### Returns
|
|
508
|
-
|
|
509
|
-
`Promise`<`unknown`\>
|
|
510
|
-
|
|
511
512
|
___
|
|
512
513
|
|
|
513
514
|
### SurveyStartFunction
|
|
@@ -520,6 +521,18 @@ ___
|
|
|
520
521
|
|
|
521
522
|
Starts a survey by its ID.
|
|
522
523
|
|
|
524
|
+
##### Parameters
|
|
525
|
+
|
|
526
|
+
| Name | Type |
|
|
527
|
+
| :------ | :------ |
|
|
528
|
+
| `surveyId` | `string` |
|
|
529
|
+
| `allowMultipleResponses` | `boolean` |
|
|
530
|
+
| `hiddenFields` | `PropertyRecord` |
|
|
531
|
+
|
|
532
|
+
##### Returns
|
|
533
|
+
|
|
534
|
+
`Promise`<`unknown`\>
|
|
535
|
+
|
|
523
536
|
**`Example`**
|
|
524
537
|
|
|
525
538
|
```ts
|
|
@@ -535,18 +548,6 @@ surveyStart(
|
|
|
535
548
|
);
|
|
536
549
|
```
|
|
537
550
|
|
|
538
|
-
##### Parameters
|
|
539
|
-
|
|
540
|
-
| Name | Type |
|
|
541
|
-
| :------ | :------ |
|
|
542
|
-
| `surveyId` | `string` |
|
|
543
|
-
| `allowMultipleResponses` | `boolean` |
|
|
544
|
-
| `hiddenFields` | `PropertyRecord` |
|
|
545
|
-
|
|
546
|
-
##### Returns
|
|
547
|
-
|
|
548
|
-
`Promise`<`unknown`\>
|
|
549
|
-
|
|
550
551
|
___
|
|
551
552
|
|
|
552
553
|
### TargetingCheckFunction
|
|
@@ -559,6 +560,10 @@ ___
|
|
|
559
560
|
|
|
560
561
|
Forces a targeting check.
|
|
561
562
|
|
|
563
|
+
##### Returns
|
|
564
|
+
|
|
565
|
+
`Promise`<`unknown`\>
|
|
566
|
+
|
|
562
567
|
**`Example`**
|
|
563
568
|
|
|
564
569
|
```ts
|
|
@@ -567,10 +572,6 @@ const { targetingCheck } = useScreeb();
|
|
|
567
572
|
targetingCheck();
|
|
568
573
|
```
|
|
569
574
|
|
|
570
|
-
##### Returns
|
|
571
|
-
|
|
572
|
-
`Promise`<`unknown`\>
|
|
573
|
-
|
|
574
575
|
___
|
|
575
576
|
|
|
576
577
|
### TargetingDebugFunction
|
|
@@ -583,6 +584,10 @@ ___
|
|
|
583
584
|
|
|
584
585
|
Prints the current state of the targeting engine.
|
|
585
586
|
|
|
587
|
+
##### Returns
|
|
588
|
+
|
|
589
|
+
`Promise`<`unknown`\>
|
|
590
|
+
|
|
586
591
|
**`Example`**
|
|
587
592
|
|
|
588
593
|
```ts
|
|
@@ -605,15 +610,11 @@ console.log(await targetingDebug());
|
|
|
605
610
|
// - Rule of type "Capping per respondent display count": false 🔴
|
|
606
611
|
```
|
|
607
612
|
|
|
608
|
-
##### Returns
|
|
609
|
-
|
|
610
|
-
`Promise`<`unknown`\>
|
|
611
|
-
|
|
612
613
|
## Functions
|
|
613
614
|
|
|
614
615
|
### ScreebProvider
|
|
615
616
|
|
|
616
|
-
▸ **ScreebProvider**(`props`, `context?`):
|
|
617
|
+
▸ **ScreebProvider**(`props`, `context?`): `ReactNode`
|
|
617
618
|
|
|
618
619
|
#### Parameters
|
|
619
620
|
|
|
@@ -624,7 +625,7 @@ console.log(await targetingDebug());
|
|
|
624
625
|
|
|
625
626
|
#### Returns
|
|
626
627
|
|
|
627
|
-
|
|
628
|
+
`ReactNode`
|
|
628
629
|
|
|
629
630
|
___
|
|
630
631
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@screeb/sdk-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Screeb's browser sdk, optimized for React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"product discovery",
|
|
@@ -39,36 +39,36 @@
|
|
|
39
39
|
"README.md"
|
|
40
40
|
],
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "rollup -c
|
|
42
|
+
"build": "rollup -c ../../node_modules/@screeb/typescript-config/src/rollup.config.js",
|
|
43
43
|
"build:doc": "typedoc src/index.ts",
|
|
44
44
|
"clean": "rm -Rf dist",
|
|
45
45
|
"lint": "eslint .",
|
|
46
46
|
"test": "echo '@TODO'"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@screeb/sdk-browser": "^0.1.
|
|
49
|
+
"@screeb/sdk-browser": "^0.1.10"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@screeb/eslint-config": "^0.1.
|
|
52
|
+
"@screeb/eslint-config": "^0.1.6",
|
|
53
53
|
"@screeb/sdk-browser": "^0.1.6",
|
|
54
|
-
"@screeb/typescript-config": "^0.1.
|
|
55
|
-
"@types/jest": "^29.5.
|
|
56
|
-
"@types/node": "^
|
|
57
|
-
"@types/react": "^18.
|
|
58
|
-
"@types/react-dom": "^18.
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
60
|
-
"eslint": "^8.
|
|
61
|
-
"eslint-plugin-import": "^2.
|
|
62
|
-
"eslint-plugin-jest": "^27.2
|
|
54
|
+
"@screeb/typescript-config": "^0.1.6",
|
|
55
|
+
"@types/jest": "^29.5.5",
|
|
56
|
+
"@types/node": "^20.8.4",
|
|
57
|
+
"@types/react": "^18.2.28",
|
|
58
|
+
"@types/react-dom": "^18.2.13",
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
|
60
|
+
"eslint": "^8.51.0",
|
|
61
|
+
"eslint-plugin-import": "^2.28.1",
|
|
62
|
+
"eslint-plugin-jest": "^27.4.2",
|
|
63
63
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
64
|
-
"eslint-plugin-prettier": "^
|
|
65
|
-
"jest": "^29.
|
|
66
|
-
"prettier": "^
|
|
67
|
-
"react": "
|
|
68
|
-
"react-dom": "
|
|
69
|
-
"rollup": "^
|
|
70
|
-
"typedoc": "^0.
|
|
71
|
-
"typedoc-plugin-markdown": "^3.
|
|
64
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
65
|
+
"jest": "^29.7.0",
|
|
66
|
+
"prettier": "^3.0.3",
|
|
67
|
+
"react": ">=18.2.0",
|
|
68
|
+
"react-dom": ">=18.2.0",
|
|
69
|
+
"rollup": "^4.0.2",
|
|
70
|
+
"typedoc": "^0.25.2",
|
|
71
|
+
"typedoc-plugin-markdown": "^3.16.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"react": ">=16.8.0",
|