@screeb/sdk-react 0.2.4 → 0.3.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 +17 -1
- package/dist/es/index.mjs +17 -1
- package/package.json +1 -1
- package/readme/screeb-logo.svg +0 -15
package/dist/cjs/index.cjs
CHANGED
|
@@ -143,6 +143,7 @@ var isInitialized = false;
|
|
|
143
143
|
var ScreebProvider = function (_a) {
|
|
144
144
|
var websiteId = _a.websiteId, userId = _a.userId, userProperties = _a.userProperties, hooks = _a.hooks, language = _a.language, 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", "language", "children", "shouldLoad", "autoInit", "options"]);
|
|
145
145
|
var isLoaded = React__namespace.useRef(Screeb__namespace.isLoaded());
|
|
146
|
+
var currentUserId = React__namespace.useRef(userId);
|
|
146
147
|
// Allow data-x attributes, see https://github.com/devrnt/react-use-screeb/issues/478
|
|
147
148
|
var invalidPropKeys = Object.keys(rest).filter(function (key) { return !key.startsWith("data-"); });
|
|
148
149
|
if (invalidPropKeys.length > 0) {
|
|
@@ -339,6 +340,21 @@ var ScreebProvider = function (_a) {
|
|
|
339
340
|
case 1: return [2 /*return*/, _a.sent()];
|
|
340
341
|
}
|
|
341
342
|
}); }); }, []);
|
|
343
|
+
React__namespace.useEffect(function () {
|
|
344
|
+
if (!isInitialized) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
if (currentUserId.current === userId) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (userId) {
|
|
351
|
+
Screeb__namespace.identity(userId);
|
|
352
|
+
currentUserId.current = userId;
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
Screeb__namespace.identityReset();
|
|
356
|
+
currentUserId.current = userId;
|
|
357
|
+
}, [userId]);
|
|
342
358
|
var providerValue = React__namespace.useMemo(function () { return ({
|
|
343
359
|
close: close,
|
|
344
360
|
debug: debug,
|
|
@@ -396,4 +412,4 @@ var useScreeb = function () {
|
|
|
396
412
|
|
|
397
413
|
exports.ScreebProvider = ScreebProvider;
|
|
398
414
|
exports.useScreeb = useScreeb;
|
|
399
|
-
CONSTANTS.version = '0.
|
|
415
|
+
CONSTANTS.version = '0.3.0'
|
package/dist/es/index.mjs
CHANGED
|
@@ -121,6 +121,7 @@ var isInitialized = false;
|
|
|
121
121
|
var ScreebProvider = function (_a) {
|
|
122
122
|
var websiteId = _a.websiteId, userId = _a.userId, userProperties = _a.userProperties, hooks = _a.hooks, language = _a.language, 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", "language", "children", "shouldLoad", "autoInit", "options"]);
|
|
123
123
|
var isLoaded = React.useRef(Screeb.isLoaded());
|
|
124
|
+
var currentUserId = React.useRef(userId);
|
|
124
125
|
// Allow data-x attributes, see https://github.com/devrnt/react-use-screeb/issues/478
|
|
125
126
|
var invalidPropKeys = Object.keys(rest).filter(function (key) { return !key.startsWith("data-"); });
|
|
126
127
|
if (invalidPropKeys.length > 0) {
|
|
@@ -317,6 +318,21 @@ var ScreebProvider = function (_a) {
|
|
|
317
318
|
case 1: return [2 /*return*/, _a.sent()];
|
|
318
319
|
}
|
|
319
320
|
}); }); }, []);
|
|
321
|
+
React.useEffect(function () {
|
|
322
|
+
if (!isInitialized) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (currentUserId.current === userId) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (userId) {
|
|
329
|
+
Screeb.identity(userId);
|
|
330
|
+
currentUserId.current = userId;
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
Screeb.identityReset();
|
|
334
|
+
currentUserId.current = userId;
|
|
335
|
+
}, [userId]);
|
|
320
336
|
var providerValue = React.useMemo(function () { return ({
|
|
321
337
|
close: close,
|
|
322
338
|
debug: debug,
|
|
@@ -373,4 +389,4 @@ var useScreeb = function () {
|
|
|
373
389
|
};
|
|
374
390
|
|
|
375
391
|
export { ScreebProvider, useScreeb };
|
|
376
|
-
CONSTANTS.version = '0.
|
|
392
|
+
CONSTANTS.version = '0.3.0'
|
package/package.json
CHANGED
package/readme/screeb-logo.svg
DELETED
|
@@ -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>
|