@screeb/sdk-react 0.3.0 → 0.5.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.
@@ -318,11 +318,30 @@ var ScreebProvider = function (_a) {
318
318
  case 1: return [2 /*return*/, _a.sent()];
319
319
  }
320
320
  }); }); }, []);
321
- var messageStart = React__namespace.useCallback(function (messageId, hiddenFields, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
321
+ var messageStart = React__namespace.useCallback(function (messageId, allowMultipleResponses, hiddenFields, hooks, language) {
322
+ if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
323
+ return __awaiter(void 0, void 0, void 0, function () {
324
+ return __generator(this, function (_a) {
325
+ switch (_a.label) {
326
+ case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
327
+ return Screeb__namespace.messageStart(messageId, allowMultipleResponses, hiddenFields, hooks, language);
328
+ })];
329
+ case 1: return [2 /*return*/, _a.sent()];
330
+ }
331
+ });
332
+ });
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 () {
322
341
  return __generator(this, function (_a) {
323
342
  switch (_a.label) {
324
- case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
325
- return Screeb__namespace.messageStart(messageId, hiddenFields, hooks, language);
343
+ case 0: return [4 /*yield*/, ensureScreeb("sessionReplayStart", function () {
344
+ return Screeb__namespace.sessionReplayStart();
326
345
  })];
327
346
  case 1: return [2 /*return*/, _a.sent()];
328
347
  }
@@ -371,6 +390,8 @@ var ScreebProvider = function (_a) {
371
390
  surveyStart: surveyStart,
372
391
  messageClose: messageClose,
373
392
  messageStart: messageStart,
393
+ sessionReplayStop: sessionReplayStop,
394
+ sessionReplayStart: sessionReplayStart,
374
395
  targetingCheck: targetingCheck,
375
396
  targetingDebug: targetingDebug,
376
397
  }); }, [
@@ -389,6 +410,8 @@ var ScreebProvider = function (_a) {
389
410
  surveyStart,
390
411
  messageClose,
391
412
  messageStart,
413
+ sessionReplayStop,
414
+ sessionReplayStart,
392
415
  targetingCheck,
393
416
  targetingDebug,
394
417
  ]);
@@ -412,4 +435,4 @@ var useScreeb = function () {
412
435
 
413
436
  exports.ScreebProvider = ScreebProvider;
414
437
  exports.useScreeb = useScreeb;
415
- CONSTANTS.version = '0.3.0'
438
+ CONSTANTS.version = '0.5.0'
@@ -330,7 +330,29 @@ export type MessageCloseFunction = () => Promise<unknown>;
330
330
  * );
331
331
  * ```
332
332
  */
333
- export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
333
+ export type MessageStartFunction = (messageId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
334
+ /**
335
+ * Interrupts a running session replay.
336
+ *
337
+ * @example
338
+ * ```ts
339
+ * const { sessionReplayStop } = useScreeb();
340
+ *
341
+ * sessionReplayStop();
342
+ * ```
343
+ */
344
+ export type SessionReplayStopFunction = () => Promise<unknown>;
345
+ /**
346
+ * Starts a session replay.
347
+ *
348
+ * @example
349
+ * ```ts
350
+ * const { sessionReplayStart } = useScreeb();
351
+ *
352
+ * sessionReplayStart();
353
+ * ```
354
+ */
355
+ export type SessionReplayStartFunction = () => Promise<unknown>;
334
356
  /**
335
357
  * Forces a targeting check.
336
358
  *
@@ -384,6 +406,8 @@ export type ScreebContextValues = {
384
406
  surveyStart: SurveyStartFunction;
385
407
  messageClose: MessageCloseFunction;
386
408
  messageStart: MessageStartFunction;
409
+ sessionReplayStart: SessionReplayStartFunction;
410
+ sessionReplayStop: SessionReplayStopFunction;
387
411
  targetingCheck: TargetingCheckFunction;
388
412
  targetingDebug: TargetingDebugFunction;
389
413
  };
package/dist/es/index.mjs CHANGED
@@ -296,11 +296,30 @@ var ScreebProvider = function (_a) {
296
296
  case 1: return [2 /*return*/, _a.sent()];
297
297
  }
298
298
  }); }); }, []);
299
- var messageStart = React.useCallback(function (messageId, hiddenFields, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
299
+ var messageStart = React.useCallback(function (messageId, allowMultipleResponses, hiddenFields, hooks, language) {
300
+ if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
301
+ return __awaiter(void 0, void 0, void 0, function () {
302
+ return __generator(this, function (_a) {
303
+ switch (_a.label) {
304
+ case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
305
+ return Screeb.messageStart(messageId, allowMultipleResponses, hiddenFields, hooks, language);
306
+ })];
307
+ case 1: return [2 /*return*/, _a.sent()];
308
+ }
309
+ });
310
+ });
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 () {
300
319
  return __generator(this, function (_a) {
301
320
  switch (_a.label) {
302
- case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
303
- return Screeb.messageStart(messageId, hiddenFields, hooks, language);
321
+ case 0: return [4 /*yield*/, ensureScreeb("sessionReplayStart", function () {
322
+ return Screeb.sessionReplayStart();
304
323
  })];
305
324
  case 1: return [2 /*return*/, _a.sent()];
306
325
  }
@@ -349,6 +368,8 @@ var ScreebProvider = function (_a) {
349
368
  surveyStart: surveyStart,
350
369
  messageClose: messageClose,
351
370
  messageStart: messageStart,
371
+ sessionReplayStop: sessionReplayStop,
372
+ sessionReplayStart: sessionReplayStart,
352
373
  targetingCheck: targetingCheck,
353
374
  targetingDebug: targetingDebug,
354
375
  }); }, [
@@ -367,6 +388,8 @@ var ScreebProvider = function (_a) {
367
388
  surveyStart,
368
389
  messageClose,
369
390
  messageStart,
391
+ sessionReplayStop,
392
+ sessionReplayStart,
370
393
  targetingCheck,
371
394
  targetingDebug,
372
395
  ]);
@@ -389,4 +412,4 @@ var useScreeb = function () {
389
412
  };
390
413
 
391
414
  export { ScreebProvider, useScreeb };
392
- CONSTANTS.version = '0.3.0'
415
+ CONSTANTS.version = '0.5.0'
@@ -330,7 +330,29 @@ export type MessageCloseFunction = () => Promise<unknown>;
330
330
  * );
331
331
  * ```
332
332
  */
333
- export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
333
+ export type MessageStartFunction = (messageId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
334
+ /**
335
+ * Interrupts a running session replay.
336
+ *
337
+ * @example
338
+ * ```ts
339
+ * const { sessionReplayStop } = useScreeb();
340
+ *
341
+ * sessionReplayStop();
342
+ * ```
343
+ */
344
+ export type SessionReplayStopFunction = () => Promise<unknown>;
345
+ /**
346
+ * Starts a session replay.
347
+ *
348
+ * @example
349
+ * ```ts
350
+ * const { sessionReplayStart } = useScreeb();
351
+ *
352
+ * sessionReplayStart();
353
+ * ```
354
+ */
355
+ export type SessionReplayStartFunction = () => Promise<unknown>;
334
356
  /**
335
357
  * Forces a targeting check.
336
358
  *
@@ -384,6 +406,8 @@ export type ScreebContextValues = {
384
406
  surveyStart: SurveyStartFunction;
385
407
  messageClose: MessageCloseFunction;
386
408
  messageStart: MessageStartFunction;
409
+ sessionReplayStart: SessionReplayStartFunction;
410
+ sessionReplayStop: SessionReplayStopFunction;
387
411
  targetingCheck: TargetingCheckFunction;
388
412
  targetingDebug: TargetingDebugFunction;
389
413
  };
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)
@@ -465,7 +467,7 @@ ___
465
467
 
466
468
  ### MessageStartFunction
467
469
 
468
- Ƭ **MessageStartFunction**: (`messageId`: `string`, `hiddenFields`: `PropertyRecord`, `hooks?`: `HooksMessageStart`, `language?`: `string`) => `Promise`\<`unknown`\>
470
+ Ƭ **MessageStartFunction**: (`messageId`: `string`, `allowMultipleResponses?`: `boolean`, `hiddenFields?`: `PropertyRecord`, `hooks?`: `HooksMessageStart`, `language?`: `string`) => `Promise`\<`unknown`\>
469
471
 
470
472
  Starts a message by its ID.
471
473
 
@@ -486,14 +488,15 @@ messageStart(
486
488
 
487
489
  #### Type declaration
488
490
 
489
- ▸ (`messageId`, `hiddenFields`, `hooks?`, `language?`): `Promise`\<`unknown`\>
491
+ ▸ (`messageId`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`): `Promise`\<`unknown`\>
490
492
 
491
493
  ##### Parameters
492
494
 
493
495
  | Name | Type |
494
496
  | :------ | :------ |
495
497
  | `messageId` | `string` |
496
- | `hiddenFields` | `PropertyRecord` |
498
+ | `allowMultipleResponses?` | `boolean` |
499
+ | `hiddenFields?` | `PropertyRecord` |
497
500
  | `hooks?` | `HooksMessageStart` |
498
501
  | `language?` | `string` |
499
502
 
@@ -526,6 +529,8 @@ Screeb context API
526
529
  | `load` | [`LoadFunction`](README.md#loadfunction) |
527
530
  | `messageClose` | [`MessageCloseFunction`](README.md#messageclosefunction) |
528
531
  | `messageStart` | [`MessageStartFunction`](README.md#messagestartfunction) |
532
+ | `sessionReplayStart` | [`SessionReplayStartFunction`](README.md#sessionreplaystartfunction) |
533
+ | `sessionReplayStop` | [`SessionReplayStopFunction`](README.md#sessionreplaystopfunction) |
529
534
  | `surveyClose` | [`SurveyCloseFunction`](README.md#surveyclosefunction) |
530
535
  | `surveyStart` | [`SurveyStartFunction`](README.md#surveystartfunction) |
531
536
  | `targetingCheck` | [`TargetingCheckFunction`](README.md#targetingcheckfunction) |
@@ -559,6 +564,54 @@ Properties of Screeb provider
559
564
 
560
565
  ___
561
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
+
562
615
  ### SurveyCloseFunction
563
616
 
564
617
  Ƭ **SurveyCloseFunction**: () => `Promise`\<`unknown`\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-react",
3
- "version": "0.3.0",
3
+ "version": "0.5.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.2.2"
44
+ "@screeb/sdk-browser": "^0.4.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@screeb/eslint-config": "^0.1.6",