@speedkit/cli 3.38.0 → 3.39.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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# [3.39.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.38.0...v3.39.0) (2026-04-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add activeSiteCheck as default ([947edda](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/947eddac5f716d05b8f3dc516ddbdad2e44ff16e))
|
|
7
|
+
* implement new soft2HardNavPlugin ([6d29110](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/6d29110a1851048fdf16fa6ad0520a5a908f492e))
|
|
8
|
+
|
|
1
9
|
# [3.38.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.37.0...v3.38.0) (2026-03-31)
|
|
2
10
|
|
|
3
11
|
|
package/README.md
CHANGED
|
@@ -48,7 +48,31 @@ import { PredictivePreloading } from 'predictive-preloading/predictivePreloading
|
|
|
48
48
|
}
|
|
49
49
|
{{/if}}),
|
|
50
50
|
{{#if hasSoftNavigations}}
|
|
51
|
-
|
|
51
|
+
{{#if convertSoftToHardNavigations}}
|
|
52
|
+
new SpaBundle({
|
|
53
|
+
enforceHardNavigation: {
|
|
54
|
+
/**
|
|
55
|
+
* @todo add selectors or urls to filter links that should never be converted
|
|
56
|
+
*
|
|
57
|
+
* @param url {string}
|
|
58
|
+
* @param element {HTMLAnchorElement}
|
|
59
|
+
* @returns {boolean}
|
|
60
|
+
*/
|
|
61
|
+
filter: (url, element) => {
|
|
62
|
+
// var isMainMenu = element.closest("#MAIN_NAVIGATION_MENU,.burger-menu-body");
|
|
63
|
+
// if(isMainMenu) return false
|
|
64
|
+
|
|
65
|
+
// checks if the currentSite is enabled and an active site
|
|
66
|
+
var isActiveSite =
|
|
67
|
+
SpeedKit.isPageTypeEnabled(location.href) ||
|
|
68
|
+
(speedKit.activeSites ?? []).some((rule) => SpeedKit.testSpeedKitRule(rule, location, speedKit));
|
|
69
|
+
return isActiveSite;
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}), // Soft Navigation Tracking using History API
|
|
73
|
+
{{else}}
|
|
74
|
+
new SpaBundle(), // Soft Navigation Tracking using History API
|
|
75
|
+
{{/if}}
|
|
52
76
|
{{/if}}
|
|
53
77
|
{{#if useGATracking}}
|
|
54
78
|
new GAEcommerceTrackingPlugin({
|
|
@@ -271,22 +295,6 @@ import { PredictivePreloading } from 'predictive-preloading/predictivePreloading
|
|
|
271
295
|
},
|
|
272
296
|
{{/if}}
|
|
273
297
|
{{/if}}
|
|
274
|
-
{{#if convertSoftToHardNavigations}}
|
|
275
|
-
{
|
|
276
|
-
on: "domInteractive",
|
|
277
|
-
track: () => {
|
|
278
|
-
if (
|
|
279
|
-
// check that dashboard is not disabled and user is in group A
|
|
280
|
-
window?.SpeedKit?.lastNavigate?.disconnectCause?.indexOf("DashboardDisabled") > -1 ||
|
|
281
|
-
!window?.SpeedKit?.skSupported ||
|
|
282
|
-
window?.SpeedKit?.group !== "A"
|
|
283
|
-
) {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
convertSoftToHardNavigation();
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
{{/if}}
|
|
290
298
|
{{#if isPlentymarkets}}
|
|
291
299
|
{
|
|
292
300
|
on: "domInteractive",
|
|
@@ -385,84 +393,6 @@ import { PredictivePreloading } from 'predictive-preloading/predictivePreloading
|
|
|
385
393
|
});
|
|
386
394
|
{{/if}}
|
|
387
395
|
|
|
388
|
-
{{#if convertSoftToHardNavigations}}
|
|
389
|
-
function softNavShouldBeConverted(url) {
|
|
390
|
-
// no link item found
|
|
391
|
-
if (!url || url === location.href) {
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
try {
|
|
396
|
-
// Always resolve the target relative to the current location
|
|
397
|
-
var resolvedTarget = new URL(url, location.href);
|
|
398
|
-
|
|
399
|
-
if (location.origin !== resolvedTarget?.origin) {
|
|
400
|
-
return false;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// must be a different path
|
|
404
|
-
if (location.pathname === resolvedTarget?.pathname) {
|
|
405
|
-
return false;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if (!SpeedKit?.isPageTypeEnabled(resolvedTarget.href)) {
|
|
409
|
-
return false;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
if (
|
|
413
|
-
// speedKit sw is known
|
|
414
|
-
window?.speedKit?.sw &&
|
|
415
|
-
// can detect sw
|
|
416
|
-
navigator?.serviceWorker?.controller?.scriptURL &&
|
|
417
|
-
navigator.serviceWorker.controller.scriptURL.indexOf(new URL(window.speedKit.sw, location.origin).pathname) > -1
|
|
418
|
-
) {
|
|
419
|
-
return true;
|
|
420
|
-
}
|
|
421
|
-
} catch (e) {}
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function convertSoftToHardNavigation() {
|
|
426
|
-
function speedKitClickEventListener(event) {
|
|
427
|
-
var target = event.target.closest("a");
|
|
428
|
-
|
|
429
|
-
// Drop out if no link address is found or the target is the current page
|
|
430
|
-
if (!target || !target.href || target.href === location.href) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
// Don't convert to hard navigation if it is just a product variant switch
|
|
435
|
-
// TODO: adjust conditions to customer-specific implementation as needed
|
|
436
|
-
var targetPathname = new URL(target.href).pathname;
|
|
437
|
-
var isPDP = targetPathname.indexOf("/p/") !== -1;
|
|
438
|
-
var isSamePathname = new URL(location.href).pathname === targetPathname;
|
|
439
|
-
var variantSwitchIdentifier = target.matches('.color-option, .size-option, .swatch-option');
|
|
440
|
-
if (
|
|
441
|
-
(isPDP && isSamePathname) || // url-based check
|
|
442
|
-
variantSwitchIdentifier // element-based check
|
|
443
|
-
) {
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
// Check if the target is enabled by SpeedKit and is a valid page for conversion
|
|
448
|
-
if (!softNavShouldBeConverted(target?.href)) {
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// Prevent soft navigation
|
|
453
|
-
event.preventDefault();
|
|
454
|
-
setTimeout(() => {
|
|
455
|
-
// let potential click listener be completed
|
|
456
|
-
|
|
457
|
-
//Execute hard navigation instead
|
|
458
|
-
location.href = target.href;
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
window.addEventListener("click", speedKitClickEventListener, true);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
{{/if}}
|
|
465
|
-
|
|
466
396
|
// TODO: check if prerendering needs to be scoped to certain pages
|
|
467
397
|
new PredictivePreloading({ prerender: true });
|
|
468
398
|
}();
|
package/oclif.manifest.json
CHANGED