@screeb/sdk-react 0.4.0 → 0.6.0
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/cjs/index.cjs +23 -3
- package/dist/cjs/types.d.ts +33 -3
- package/dist/es/index.mjs +23 -3
- package/dist/es/types.d.ts +33 -3
- package/docs/README.md +63 -4
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -302,11 +302,11 @@ var ScreebProvider = function (_a) {
|
|
|
302
302
|
case 1: return [2 /*return*/, _a.sent()];
|
|
303
303
|
}
|
|
304
304
|
}); }); }, []);
|
|
305
|
-
var surveyStart = React__namespace.useCallback(function (surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
|
|
305
|
+
var surveyStart = React__namespace.useCallback(function (surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language, selectors) { return __awaiter(void 0, void 0, void 0, function () {
|
|
306
306
|
return __generator(this, function (_a) {
|
|
307
307
|
switch (_a.label) {
|
|
308
308
|
case 0: return [4 /*yield*/, ensureScreeb("surveyStart", function () {
|
|
309
|
-
return Screeb__namespace.surveyStart(surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language);
|
|
309
|
+
return Screeb__namespace.surveyStart(surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language, selectors);
|
|
310
310
|
})];
|
|
311
311
|
case 1: return [2 /*return*/, _a.sent()];
|
|
312
312
|
}
|
|
@@ -331,6 +331,22 @@ var ScreebProvider = function (_a) {
|
|
|
331
331
|
});
|
|
332
332
|
});
|
|
333
333
|
}, []);
|
|
334
|
+
var sessionReplayStop = React__namespace.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
335
|
+
switch (_a.label) {
|
|
336
|
+
case 0: return [4 /*yield*/, ensureScreeb("sessionReplayStop", function () { return Screeb__namespace.sessionReplayStop(); })];
|
|
337
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
338
|
+
}
|
|
339
|
+
}); }); }, []);
|
|
340
|
+
var sessionReplayStart = React__namespace.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
341
|
+
return __generator(this, function (_a) {
|
|
342
|
+
switch (_a.label) {
|
|
343
|
+
case 0: return [4 /*yield*/, ensureScreeb("sessionReplayStart", function () {
|
|
344
|
+
return Screeb__namespace.sessionReplayStart();
|
|
345
|
+
})];
|
|
346
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}); }, []);
|
|
334
350
|
var targetingCheck = React__namespace.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
335
351
|
switch (_a.label) {
|
|
336
352
|
case 0: return [4 /*yield*/, ensureScreeb("targetingCheck", function () { return Screeb__namespace.targetingCheck(); })];
|
|
@@ -374,6 +390,8 @@ var ScreebProvider = function (_a) {
|
|
|
374
390
|
surveyStart: surveyStart,
|
|
375
391
|
messageClose: messageClose,
|
|
376
392
|
messageStart: messageStart,
|
|
393
|
+
sessionReplayStop: sessionReplayStop,
|
|
394
|
+
sessionReplayStart: sessionReplayStart,
|
|
377
395
|
targetingCheck: targetingCheck,
|
|
378
396
|
targetingDebug: targetingDebug,
|
|
379
397
|
}); }, [
|
|
@@ -392,6 +410,8 @@ var ScreebProvider = function (_a) {
|
|
|
392
410
|
surveyStart,
|
|
393
411
|
messageClose,
|
|
394
412
|
messageStart,
|
|
413
|
+
sessionReplayStop,
|
|
414
|
+
sessionReplayStart,
|
|
395
415
|
targetingCheck,
|
|
396
416
|
targetingDebug,
|
|
397
417
|
]);
|
|
@@ -415,4 +435,4 @@ var useScreeb = function () {
|
|
|
415
435
|
|
|
416
436
|
exports.ScreebProvider = ScreebProvider;
|
|
417
437
|
exports.useScreeb = useScreeb;
|
|
418
|
-
CONSTANTS.version = '0.
|
|
438
|
+
CONSTANTS.version = '0.6.0'
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -294,14 +294,20 @@ export type SurveyCloseFunction = () => Promise<unknown>;
|
|
|
294
294
|
* '<UUID>',
|
|
295
295
|
* '<UUID>',
|
|
296
296
|
* false,
|
|
297
|
-
* {
|
|
297
|
+
* { // optional
|
|
298
298
|
* color: "green",
|
|
299
299
|
* article_id: 42
|
|
300
|
-
* }
|
|
300
|
+
* },
|
|
301
|
+
* { // optional
|
|
302
|
+
* version: "1.0.0",
|
|
303
|
+
* onSurveyShowed: (payload) => console.log("Survey showed", payload),
|
|
304
|
+
* },
|
|
305
|
+
* "en", // optional
|
|
306
|
+
* "#screeb-survey-container" // optional
|
|
301
307
|
* );
|
|
302
308
|
* ```
|
|
303
309
|
*/
|
|
304
|
-
export type SurveyStartFunction = (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string) => Promise<unknown>;
|
|
310
|
+
export type SurveyStartFunction = (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string, selectors?: string | string[]) => Promise<unknown>;
|
|
305
311
|
/**
|
|
306
312
|
* Interrupts a running message.
|
|
307
313
|
*
|
|
@@ -331,6 +337,28 @@ export type MessageCloseFunction = () => Promise<unknown>;
|
|
|
331
337
|
* ```
|
|
332
338
|
*/
|
|
333
339
|
export type MessageStartFunction = (messageId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
|
|
340
|
+
/**
|
|
341
|
+
* Interrupts a running session replay.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* const { sessionReplayStop } = useScreeb();
|
|
346
|
+
*
|
|
347
|
+
* sessionReplayStop();
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
export type SessionReplayStopFunction = () => Promise<unknown>;
|
|
351
|
+
/**
|
|
352
|
+
* Starts a session replay.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```ts
|
|
356
|
+
* const { sessionReplayStart } = useScreeb();
|
|
357
|
+
*
|
|
358
|
+
* sessionReplayStart();
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
export type SessionReplayStartFunction = () => Promise<unknown>;
|
|
334
362
|
/**
|
|
335
363
|
* Forces a targeting check.
|
|
336
364
|
*
|
|
@@ -384,6 +412,8 @@ export type ScreebContextValues = {
|
|
|
384
412
|
surveyStart: SurveyStartFunction;
|
|
385
413
|
messageClose: MessageCloseFunction;
|
|
386
414
|
messageStart: MessageStartFunction;
|
|
415
|
+
sessionReplayStart: SessionReplayStartFunction;
|
|
416
|
+
sessionReplayStop: SessionReplayStopFunction;
|
|
387
417
|
targetingCheck: TargetingCheckFunction;
|
|
388
418
|
targetingDebug: TargetingDebugFunction;
|
|
389
419
|
};
|
package/dist/es/index.mjs
CHANGED
|
@@ -280,11 +280,11 @@ var ScreebProvider = function (_a) {
|
|
|
280
280
|
case 1: return [2 /*return*/, _a.sent()];
|
|
281
281
|
}
|
|
282
282
|
}); }); }, []);
|
|
283
|
-
var surveyStart = React.useCallback(function (surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
|
|
283
|
+
var surveyStart = React.useCallback(function (surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language, selectors) { return __awaiter(void 0, void 0, void 0, function () {
|
|
284
284
|
return __generator(this, function (_a) {
|
|
285
285
|
switch (_a.label) {
|
|
286
286
|
case 0: return [4 /*yield*/, ensureScreeb("surveyStart", function () {
|
|
287
|
-
return Screeb.surveyStart(surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language);
|
|
287
|
+
return Screeb.surveyStart(surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language, selectors);
|
|
288
288
|
})];
|
|
289
289
|
case 1: return [2 /*return*/, _a.sent()];
|
|
290
290
|
}
|
|
@@ -309,6 +309,22 @@ var ScreebProvider = function (_a) {
|
|
|
309
309
|
});
|
|
310
310
|
});
|
|
311
311
|
}, []);
|
|
312
|
+
var sessionReplayStop = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
313
|
+
switch (_a.label) {
|
|
314
|
+
case 0: return [4 /*yield*/, ensureScreeb("sessionReplayStop", function () { return Screeb.sessionReplayStop(); })];
|
|
315
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
316
|
+
}
|
|
317
|
+
}); }); }, []);
|
|
318
|
+
var sessionReplayStart = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
319
|
+
return __generator(this, function (_a) {
|
|
320
|
+
switch (_a.label) {
|
|
321
|
+
case 0: return [4 /*yield*/, ensureScreeb("sessionReplayStart", function () {
|
|
322
|
+
return Screeb.sessionReplayStart();
|
|
323
|
+
})];
|
|
324
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}); }, []);
|
|
312
328
|
var targetingCheck = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
313
329
|
switch (_a.label) {
|
|
314
330
|
case 0: return [4 /*yield*/, ensureScreeb("targetingCheck", function () { return Screeb.targetingCheck(); })];
|
|
@@ -352,6 +368,8 @@ var ScreebProvider = function (_a) {
|
|
|
352
368
|
surveyStart: surveyStart,
|
|
353
369
|
messageClose: messageClose,
|
|
354
370
|
messageStart: messageStart,
|
|
371
|
+
sessionReplayStop: sessionReplayStop,
|
|
372
|
+
sessionReplayStart: sessionReplayStart,
|
|
355
373
|
targetingCheck: targetingCheck,
|
|
356
374
|
targetingDebug: targetingDebug,
|
|
357
375
|
}); }, [
|
|
@@ -370,6 +388,8 @@ var ScreebProvider = function (_a) {
|
|
|
370
388
|
surveyStart,
|
|
371
389
|
messageClose,
|
|
372
390
|
messageStart,
|
|
391
|
+
sessionReplayStop,
|
|
392
|
+
sessionReplayStart,
|
|
373
393
|
targetingCheck,
|
|
374
394
|
targetingDebug,
|
|
375
395
|
]);
|
|
@@ -392,4 +412,4 @@ var useScreeb = function () {
|
|
|
392
412
|
};
|
|
393
413
|
|
|
394
414
|
export { ScreebProvider, useScreeb };
|
|
395
|
-
CONSTANTS.version = '0.
|
|
415
|
+
CONSTANTS.version = '0.6.0'
|
package/dist/es/types.d.ts
CHANGED
|
@@ -294,14 +294,20 @@ export type SurveyCloseFunction = () => Promise<unknown>;
|
|
|
294
294
|
* '<UUID>',
|
|
295
295
|
* '<UUID>',
|
|
296
296
|
* false,
|
|
297
|
-
* {
|
|
297
|
+
* { // optional
|
|
298
298
|
* color: "green",
|
|
299
299
|
* article_id: 42
|
|
300
|
-
* }
|
|
300
|
+
* },
|
|
301
|
+
* { // optional
|
|
302
|
+
* version: "1.0.0",
|
|
303
|
+
* onSurveyShowed: (payload) => console.log("Survey showed", payload),
|
|
304
|
+
* },
|
|
305
|
+
* "en", // optional
|
|
306
|
+
* "#screeb-survey-container" // optional
|
|
301
307
|
* );
|
|
302
308
|
* ```
|
|
303
309
|
*/
|
|
304
|
-
export type SurveyStartFunction = (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string) => Promise<unknown>;
|
|
310
|
+
export type SurveyStartFunction = (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string, selectors?: string | string[]) => Promise<unknown>;
|
|
305
311
|
/**
|
|
306
312
|
* Interrupts a running message.
|
|
307
313
|
*
|
|
@@ -331,6 +337,28 @@ export type MessageCloseFunction = () => Promise<unknown>;
|
|
|
331
337
|
* ```
|
|
332
338
|
*/
|
|
333
339
|
export type MessageStartFunction = (messageId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
|
|
340
|
+
/**
|
|
341
|
+
* Interrupts a running session replay.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* const { sessionReplayStop } = useScreeb();
|
|
346
|
+
*
|
|
347
|
+
* sessionReplayStop();
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
export type SessionReplayStopFunction = () => Promise<unknown>;
|
|
351
|
+
/**
|
|
352
|
+
* Starts a session replay.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```ts
|
|
356
|
+
* const { sessionReplayStart } = useScreeb();
|
|
357
|
+
*
|
|
358
|
+
* sessionReplayStart();
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
export type SessionReplayStartFunction = () => Promise<unknown>;
|
|
334
362
|
/**
|
|
335
363
|
* Forces a targeting check.
|
|
336
364
|
*
|
|
@@ -384,6 +412,8 @@ export type ScreebContextValues = {
|
|
|
384
412
|
surveyStart: SurveyStartFunction;
|
|
385
413
|
messageClose: MessageCloseFunction;
|
|
386
414
|
messageStart: MessageStartFunction;
|
|
415
|
+
sessionReplayStart: SessionReplayStartFunction;
|
|
416
|
+
sessionReplayStop: SessionReplayStopFunction;
|
|
387
417
|
targetingCheck: TargetingCheckFunction;
|
|
388
418
|
targetingDebug: TargetingDebugFunction;
|
|
389
419
|
};
|
package/docs/README.md
CHANGED
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
- [ScreebContextValues](README.md#screebcontextvalues)
|
|
23
23
|
- [ScreebProps](README.md#screebprops)
|
|
24
24
|
- [ScreebProviderProps](README.md#screebproviderprops)
|
|
25
|
+
- [SessionReplayStartFunction](README.md#sessionreplaystartfunction)
|
|
26
|
+
- [SessionReplayStopFunction](README.md#sessionreplaystopfunction)
|
|
25
27
|
- [SurveyCloseFunction](README.md#surveyclosefunction)
|
|
26
28
|
- [SurveyStartFunction](README.md#surveystartfunction)
|
|
27
29
|
- [TargetingCheckFunction](README.md#targetingcheckfunction)
|
|
@@ -527,6 +529,8 @@ Screeb context API
|
|
|
527
529
|
| `load` | [`LoadFunction`](README.md#loadfunction) |
|
|
528
530
|
| `messageClose` | [`MessageCloseFunction`](README.md#messageclosefunction) |
|
|
529
531
|
| `messageStart` | [`MessageStartFunction`](README.md#messagestartfunction) |
|
|
532
|
+
| `sessionReplayStart` | [`SessionReplayStartFunction`](README.md#sessionreplaystartfunction) |
|
|
533
|
+
| `sessionReplayStop` | [`SessionReplayStopFunction`](README.md#sessionreplaystopfunction) |
|
|
530
534
|
| `surveyClose` | [`SurveyCloseFunction`](README.md#surveyclosefunction) |
|
|
531
535
|
| `surveyStart` | [`SurveyStartFunction`](README.md#surveystartfunction) |
|
|
532
536
|
| `targetingCheck` | [`TargetingCheckFunction`](README.md#targetingcheckfunction) |
|
|
@@ -560,6 +564,54 @@ Properties of Screeb provider
|
|
|
560
564
|
|
|
561
565
|
___
|
|
562
566
|
|
|
567
|
+
### SessionReplayStartFunction
|
|
568
|
+
|
|
569
|
+
Ƭ **SessionReplayStartFunction**: () => `Promise`\<`unknown`\>
|
|
570
|
+
|
|
571
|
+
Starts a session replay.
|
|
572
|
+
|
|
573
|
+
**`Example`**
|
|
574
|
+
|
|
575
|
+
```ts
|
|
576
|
+
const { sessionReplayStart } = useScreeb();
|
|
577
|
+
|
|
578
|
+
sessionReplayStart();
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
#### Type declaration
|
|
582
|
+
|
|
583
|
+
▸ (): `Promise`\<`unknown`\>
|
|
584
|
+
|
|
585
|
+
##### Returns
|
|
586
|
+
|
|
587
|
+
`Promise`\<`unknown`\>
|
|
588
|
+
|
|
589
|
+
___
|
|
590
|
+
|
|
591
|
+
### SessionReplayStopFunction
|
|
592
|
+
|
|
593
|
+
Ƭ **SessionReplayStopFunction**: () => `Promise`\<`unknown`\>
|
|
594
|
+
|
|
595
|
+
Interrupts a running session replay.
|
|
596
|
+
|
|
597
|
+
**`Example`**
|
|
598
|
+
|
|
599
|
+
```ts
|
|
600
|
+
const { sessionReplayStop } = useScreeb();
|
|
601
|
+
|
|
602
|
+
sessionReplayStop();
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
#### Type declaration
|
|
606
|
+
|
|
607
|
+
▸ (): `Promise`\<`unknown`\>
|
|
608
|
+
|
|
609
|
+
##### Returns
|
|
610
|
+
|
|
611
|
+
`Promise`\<`unknown`\>
|
|
612
|
+
|
|
613
|
+
___
|
|
614
|
+
|
|
563
615
|
### SurveyCloseFunction
|
|
564
616
|
|
|
565
617
|
Ƭ **SurveyCloseFunction**: () => `Promise`\<`unknown`\>
|
|
@@ -586,7 +638,7 @@ ___
|
|
|
586
638
|
|
|
587
639
|
### SurveyStartFunction
|
|
588
640
|
|
|
589
|
-
Ƭ **SurveyStartFunction**: (`surveyId`: `string`, `distributionId?`: `string`, `allowMultipleResponses?`: `boolean`, `hiddenFields?`: `PropertyRecord`, `hooks?`: `HooksSurveyStart`, `language?`: `string`) => `Promise`\<`unknown`\>
|
|
641
|
+
Ƭ **SurveyStartFunction**: (`surveyId`: `string`, `distributionId?`: `string`, `allowMultipleResponses?`: `boolean`, `hiddenFields?`: `PropertyRecord`, `hooks?`: `HooksSurveyStart`, `language?`: `string`, `selectors?`: `string` \| `string`[]) => `Promise`\<`unknown`\>
|
|
590
642
|
|
|
591
643
|
Starts a survey by its ID.
|
|
592
644
|
|
|
@@ -599,16 +651,22 @@ surveyStart(
|
|
|
599
651
|
'<UUID>',
|
|
600
652
|
'<UUID>',
|
|
601
653
|
false,
|
|
602
|
-
{
|
|
654
|
+
{ // optional
|
|
603
655
|
color: "green",
|
|
604
656
|
article_id: 42
|
|
605
|
-
}
|
|
657
|
+
},
|
|
658
|
+
{ // optional
|
|
659
|
+
version: "1.0.0",
|
|
660
|
+
onSurveyShowed: (payload) => console.log("Survey showed", payload),
|
|
661
|
+
},
|
|
662
|
+
"en", // optional
|
|
663
|
+
"#screeb-survey-container" // optional
|
|
606
664
|
);
|
|
607
665
|
```
|
|
608
666
|
|
|
609
667
|
#### Type declaration
|
|
610
668
|
|
|
611
|
-
▸ (`surveyId`, `distributionId?`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`): `Promise`\<`unknown`\>
|
|
669
|
+
▸ (`surveyId`, `distributionId?`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`, `selectors?`): `Promise`\<`unknown`\>
|
|
612
670
|
|
|
613
671
|
##### Parameters
|
|
614
672
|
|
|
@@ -620,6 +678,7 @@ surveyStart(
|
|
|
620
678
|
| `hiddenFields?` | `PropertyRecord` |
|
|
621
679
|
| `hooks?` | `HooksSurveyStart` |
|
|
622
680
|
| `language?` | `string` |
|
|
681
|
+
| `selectors?` | `string` \| `string`[] |
|
|
623
682
|
|
|
624
683
|
##### Returns
|
|
625
684
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@screeb/sdk-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Screeb's browser sdk, optimized for React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"product discovery",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"test": "echo '@TODO'"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@screeb/sdk-browser": "^0.
|
|
44
|
+
"@screeb/sdk-browser": "^0.5.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@screeb/eslint-config": "^0.1.6",
|