@screeb/sdk-react 0.1.11 → 0.1.13

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.
@@ -309,6 +309,22 @@ var ScreebProvider = function (_a) {
309
309
  }
310
310
  });
311
311
  }); }, []);
312
+ var messageClose = React__namespace.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("messageClose", function () { return Screeb__namespace.messageClose(); })];
315
+ case 1: return [2 /*return*/, _a.sent()];
316
+ }
317
+ }); }); }, []);
318
+ var messageStart = React__namespace.useCallback(function (messageId, hiddenFields, hooks, language) { 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("messageStart", function () {
322
+ return Screeb__namespace.messageStart(messageId, hiddenFields, hooks, language);
323
+ })];
324
+ case 1: return [2 /*return*/, _a.sent()];
325
+ }
326
+ });
327
+ }); }, []);
312
328
  var targetingCheck = React__namespace.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__namespace.targetingCheck(); })];
@@ -335,6 +351,8 @@ var ScreebProvider = function (_a) {
335
351
  load: load,
336
352
  surveyClose: surveyClose,
337
353
  surveyStart: surveyStart,
354
+ messageClose: messageClose,
355
+ messageStart: messageStart,
338
356
  targetingCheck: targetingCheck,
339
357
  targetingDebug: targetingDebug,
340
358
  }); }, [
@@ -351,6 +369,8 @@ var ScreebProvider = function (_a) {
351
369
  load,
352
370
  surveyClose,
353
371
  surveyStart,
372
+ messageClose,
373
+ messageStart,
354
374
  targetingCheck,
355
375
  targetingDebug,
356
376
  ]);
@@ -374,4 +394,4 @@ var useScreeb = function () {
374
394
 
375
395
  exports.ScreebProvider = ScreebProvider;
376
396
  exports.useScreeb = useScreeb;
377
- CONSTANTS.version = '0.1.11'
397
+ CONSTANTS.version = '0.1.13'
@@ -300,7 +300,36 @@ export type SurveyCloseFunction = () => Promise<unknown>;
300
300
  * );
301
301
  * ```
302
302
  */
303
- export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks: Hooks, language: string) => Promise<unknown>;
303
+ export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
+ /**
305
+ * Interrupts a running message.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * const { messageClose } = useScreeb();
310
+ *
311
+ * messageClose();
312
+ * ```
313
+ */
314
+ export type MessageCloseFunction = () => Promise<unknown>;
315
+ /**
316
+ * Starts a message by its ID.
317
+ *
318
+ * @example
319
+ * ```ts
320
+ * const { messageStart } = useScreeb();
321
+ *
322
+ * messageStart(
323
+ * '<UUID>',
324
+ * false,
325
+ * {
326
+ * color: "green",
327
+ * article_id: 42
328
+ * }
329
+ * );
330
+ * ```
331
+ */
332
+ export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
333
  /**
305
334
  * Forces a targeting check.
306
335
  *
package/dist/es/index.mjs CHANGED
@@ -287,6 +287,22 @@ var ScreebProvider = function (_a) {
287
287
  }
288
288
  });
289
289
  }); }, []);
290
+ var messageClose = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
291
+ switch (_a.label) {
292
+ case 0: return [4 /*yield*/, ensureScreeb("messageClose", function () { return Screeb.messageClose(); })];
293
+ case 1: return [2 /*return*/, _a.sent()];
294
+ }
295
+ }); }); }, []);
296
+ var messageStart = React.useCallback(function (messageId, hiddenFields, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
297
+ return __generator(this, function (_a) {
298
+ switch (_a.label) {
299
+ case 0: return [4 /*yield*/, ensureScreeb("messageStart", function () {
300
+ return Screeb.messageStart(messageId, hiddenFields, hooks, language);
301
+ })];
302
+ case 1: return [2 /*return*/, _a.sent()];
303
+ }
304
+ });
305
+ }); }, []);
290
306
  var targetingCheck = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
291
307
  switch (_a.label) {
292
308
  case 0: return [4 /*yield*/, ensureScreeb("targetingCheck", function () { return Screeb.targetingCheck(); })];
@@ -313,6 +329,8 @@ var ScreebProvider = function (_a) {
313
329
  load: load,
314
330
  surveyClose: surveyClose,
315
331
  surveyStart: surveyStart,
332
+ messageClose: messageClose,
333
+ messageStart: messageStart,
316
334
  targetingCheck: targetingCheck,
317
335
  targetingDebug: targetingDebug,
318
336
  }); }, [
@@ -329,6 +347,8 @@ var ScreebProvider = function (_a) {
329
347
  load,
330
348
  surveyClose,
331
349
  surveyStart,
350
+ messageClose,
351
+ messageStart,
332
352
  targetingCheck,
333
353
  targetingDebug,
334
354
  ]);
@@ -351,4 +371,4 @@ var useScreeb = function () {
351
371
  };
352
372
 
353
373
  export { ScreebProvider, useScreeb };
354
- CONSTANTS.version = '0.1.11'
374
+ CONSTANTS.version = '0.1.13'
@@ -300,7 +300,36 @@ export type SurveyCloseFunction = () => Promise<unknown>;
300
300
  * );
301
301
  * ```
302
302
  */
303
- export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks: Hooks, language: string) => Promise<unknown>;
303
+ export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
+ /**
305
+ * Interrupts a running message.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * const { messageClose } = useScreeb();
310
+ *
311
+ * messageClose();
312
+ * ```
313
+ */
314
+ export type MessageCloseFunction = () => Promise<unknown>;
315
+ /**
316
+ * Starts a message by its ID.
317
+ *
318
+ * @example
319
+ * ```ts
320
+ * const { messageStart } = useScreeb();
321
+ *
322
+ * messageStart(
323
+ * '<UUID>',
324
+ * false,
325
+ * {
326
+ * color: "green",
327
+ * article_id: 42
328
+ * }
329
+ * );
330
+ * ```
331
+ */
332
+ export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
333
  /**
305
334
  * Forces a targeting check.
306
335
  *
package/docs/README.md CHANGED
@@ -17,6 +17,8 @@
17
17
  - [IdentityResetFunction](README.md#identityresetfunction)
18
18
  - [InitFunction](README.md#initfunction)
19
19
  - [LoadFunction](README.md#loadfunction)
20
+ - [MessageCloseFunction](README.md#messageclosefunction)
21
+ - [MessageStartFunction](README.md#messagestartfunction)
20
22
  - [ScreebContextValues](README.md#screebcontextvalues)
21
23
  - [ScreebProps](README.md#screebprops)
22
24
  - [ScreebProviderProps](README.md#screebproviderprops)
@@ -437,6 +439,70 @@ load();
437
439
 
438
440
  ___
439
441
 
442
+ ### MessageCloseFunction
443
+
444
+ Ƭ **MessageCloseFunction**: () => `Promise`\<`unknown`\>
445
+
446
+ Interrupts a running message.
447
+
448
+ **`Example`**
449
+
450
+ ```ts
451
+ const { messageClose } = useScreeb();
452
+
453
+ messageClose();
454
+ ```
455
+
456
+ #### Type declaration
457
+
458
+ ▸ (): `Promise`\<`unknown`\>
459
+
460
+ ##### Returns
461
+
462
+ `Promise`\<`unknown`\>
463
+
464
+ ___
465
+
466
+ ### MessageStartFunction
467
+
468
+ Ƭ **MessageStartFunction**: (`messageId`: `string`, `hiddenFields`: `PropertyRecord`, `hooks?`: `Hooks`, `language?`: `string`) => `Promise`\<`unknown`\>
469
+
470
+ Starts a message by its ID.
471
+
472
+ **`Example`**
473
+
474
+ ```ts
475
+ const { messageStart } = useScreeb();
476
+
477
+ messageStart(
478
+ '<UUID>',
479
+ false,
480
+ {
481
+ color: "green",
482
+ article_id: 42
483
+ }
484
+ );
485
+ ```
486
+
487
+ #### Type declaration
488
+
489
+ ▸ (`messageId`, `hiddenFields`, `hooks?`, `language?`): `Promise`\<`unknown`\>
490
+
491
+ ##### Parameters
492
+
493
+ | Name | Type |
494
+ | :------ | :------ |
495
+ | `messageId` | `string` |
496
+ | `hiddenFields` | `PropertyRecord` |
497
+ | `hooks?` | `Hooks` |
498
+ | `language?` | `string` |
499
+
500
+ ##### Returns
501
+
502
+ `Promise`\<`unknown`\>
503
+
504
+ ___
505
+
440
506
  ### ScreebContextValues
441
507
 
442
508
  Ƭ **ScreebContextValues**: `Object`
@@ -517,7 +583,7 @@ ___
517
583
 
518
584
  ### SurveyStartFunction
519
585
 
520
- Ƭ **SurveyStartFunction**: (`surveyId`: `string`, `allowMultipleResponses`: `boolean`, `hiddenFields`: `PropertyRecord`, `hooks`: `Hooks`, `language`: `string`) => `Promise`\<`unknown`\>
586
+ Ƭ **SurveyStartFunction**: (`surveyId`: `string`, `allowMultipleResponses`: `boolean`, `hiddenFields`: `PropertyRecord`, `hooks?`: `Hooks`, `language?`: `string`) => `Promise`\<`unknown`\>
521
587
 
522
588
  Starts a survey by its ID.
523
589
 
@@ -538,7 +604,7 @@ surveyStart(
538
604
 
539
605
  #### Type declaration
540
606
 
541
- ▸ (`surveyId`, `allowMultipleResponses`, `hiddenFields`, `hooks`, `language`): `Promise`\<`unknown`\>
607
+ ▸ (`surveyId`, `allowMultipleResponses`, `hiddenFields`, `hooks?`, `language?`): `Promise`\<`unknown`\>
542
608
 
543
609
  ##### Parameters
544
610
 
@@ -547,8 +613,8 @@ surveyStart(
547
613
  | `surveyId` | `string` |
548
614
  | `allowMultipleResponses` | `boolean` |
549
615
  | `hiddenFields` | `PropertyRecord` |
550
- | `hooks` | `Hooks` |
551
- | `language` | `string` |
616
+ | `hooks?` | `Hooks` |
617
+ | `language?` | `string` |
552
618
 
553
619
  ##### Returns
554
620
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-react",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
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.1.17"
44
+ "@screeb/sdk-browser": "^0.1.18"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@screeb/eslint-config": "^0.1.6",
@@ -1,15 +0,0 @@
1
- <svg width="773" height="366" viewBox="0 0 773 366" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_201_47)">
3
- <path fill-rule="evenodd" clip-rule="evenodd"
4
- d="M711.7 197.1C714.6 194.1 717.2 191.1 719.7 187.9C750.7 201 772.5 230.9 772.4 266.5V364.7L684.5 365.3H606.7C558.6 365.3 520.5 325.3 520.5 277.1C520.5 261.5 524.5 245.9 531.5 232H630.4C661.2 232 690.1 219.5 711.7 197.1ZM600.2 292.8C609.1 292.8 616.1 285.6 616.1 276.9C616.1 268.4 609 261.2 600.2 261.2C591.5 261.2 584.5 268.4 584.5 276.9C584.5 285.6 591.5 292.8 600.2 292.8ZM645.5 292.8C654.4 292.8 661.4 285.6 661.4 276.9C661.4 268.4 654.4 261.2 645.5 261.2C636.8 261.2 629.8 268.4 629.8 276.9C629.8 285.6 636.8 292.8 645.5 292.8ZM690.9 292.8C699.8 292.8 706.8 285.6 706.8 276.9C706.8 268.4 699.7 261.2 690.9 261.2C682.2 261.2 675.2 268.4 675.2 276.9C675.2 285.6 682.2 292.8 690.9 292.8Z"
5
- fill="#5e21f1" />
6
- <path fill-rule="evenodd" clip-rule="evenodd"
7
- d="M626.5 213C682 213 725.9 166.6 725.9 111.1C725.9 55.6 682 0 626.4 0H102.7C47.2 0 0 42.7 0 98.3V211.8L102.7 213H626.5ZM98.8 147.6C98.8 151.7 100.9 155.4 103.8 157.5C117.2 167.1 133.1 171.9 148.6 171.7C174.4 171.7 192.5 158.4 192.5 134.6V134.3C192.5 113.4 178.9 104.7 154.6 98.4C133.9 93.1 128.8 90.6 128.8 82.7V82.4C128.8 76.6 134.1 72 144.2 72C152.4 72 160.6 74.9 169.3 80C171.4 81.2 173.4 81.9 176 81.9C182.8 81.9 188.3 76.6 188.3 69.8C188.3 64.7 185.4 61.1 182.5 59.4C171.8 52.6 159.1 48.8 144.6 48.8C120.1 48.8 102.7 63.2 102.7 84.9V85.2C102.7 109 118.3 115.6 142.4 121.8C162.4 126.9 166.5 130.3 166.5 137V137.4C166.5 144.4 160 148.7 149.2 148.7C137.6 148.7 127.7 144.6 118.6 137.9C116.9 136.7 114.5 135.5 111.1 135.5C104.3 135.5 98.8 140.8 98.8 147.6ZM200.8 124.9V124.6C200.8 98.4 220.8 76.9 248.8 76.9C262.6 76.9 272.4 80.7 280.1 87.2C281.8 88.6 284.2 91.6 284.2 96.1C284.2 102.6 278.9 107.7 272.4 107.7C269 107.7 266.4 106.3 264.9 105.1C260.3 101.5 255.5 99.3 248.7 99.3C235.7 99.3 226.5 110.8 226.5 124.3V124.6C226.5 138.6 235.6 149.9 249.7 149.9C256.5 149.9 261.8 147.5 266.8 143.6C268.2 142.6 270.7 141.2 273.8 141.2C280 141.2 284.7 146.2 284.7 152.3C284.7 155.7 283.2 158.5 280.9 160.5C273.2 167.5 263.5 172.3 248.4 172.3C220.9 172.2 200.8 151.1 200.8 124.9ZM308.1 77.5C300.9 77.5 295.1 83.3 295.1 90.5V158.1C295.1 165.3 300.9 171.1 308.1 171.1C315.3 171.1 321.1 165.3 321.1 158.1V133.8C321.1 115.4 328.4 105.3 341.6 102.2C346.9 101 351.3 96.9 351.3 90.1C351.3 82.8 346.7 77.5 338.7 77.5C331 77.5 324.9 85.7 321.1 94.6V90.5C321.1 83.3 315.3 77.5 308.1 77.5ZM521.3 121C521.3 102 507.8 76.9 477.2 76.9C458.9 76.9 444.3 87.1 437 101.9C430.9 88.5 418 76.9 397.2 76.9C370.5 76.9 351.9 98.4 351.9 124.6V124.9C351.9 152.9 372.2 172.3 399.8 172.3C413.1 172.3 423.6 168 431.6 161.2C433.5 159.5 435 156.9 435 153.5C435 147.7 430.7 143.2 424.9 143.2C422.2 143.2 420.5 143.9 418.6 145.3C413.3 149.2 407.3 151.5 400.1 151.5C388.5 151.5 380.3 145.3 377.7 133.6H432.561C436.215 156.976 455.14 172.4 479.8 172.4C493.1 172.4 503.6 168.1 511.6 161.3C513.5 159.6 515 157 515 153.6C515 147.8 510.7 143.3 504.9 143.3C502.2 143.3 500.5 144 498.6 145.4C493.3 149.3 487.3 151.6 480.1 151.6C468.5 151.6 460.3 145.4 457.7 133.7H509.2C516 133.4 521.3 128.5 521.3 121ZM432.5 133.2L432.522 133.349C432.308 133.302 432.246 133.251 432.5 133.2ZM377.4 117.2C379.5 105.4 386.5 97.7 397.2 97.7C408.1 97.7 415 105.6 416.5 117.2H377.4ZM457.4 117.2C459.5 105.4 466.5 97.7 477.2 97.7C488.1 97.7 495 105.6 496.5 117.2H457.4ZM546.4 44.4C539.2 44.4 533.4 50.2 533.4 57.4V158.3C533.4 165.5 539.2 171.3 546.4 171.3C553.6 171.3 559.4 165.5 559.4 158.5V158.3C565.5 165.7 574.1 172 587.9 172C609.6 172 629.6 155.2 629.6 124.6V124.3C629.6 93.7 609.3 76.9 587.9 76.9C574.4 76.9 565.7 83.3 559.4 91.8V57.4C559.4 50.2 553.6 44.4 546.4 44.4ZM603.7 124.3V124.6C603.7 139.9 593.4 149.9 581.3 149.9C569.2 149.9 559.1 139.8 559.1 124.6V124.3C559.1 109.1 569.2 99 581.3 99C593.4 99 603.7 109.1 603.7 124.3Z"
8
- fill="#5e21f1" />
9
- </g>
10
- <defs>
11
- <clipPath id="clip0_201_47">
12
- <rect width="772.5" height="365.4" fill="#5e21f1" />
13
- </clipPath>
14
- </defs>
15
- </svg>