@swisspost/internet-header 1.15.24 → 1.16.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/focus-trap.cjs.entry.js +50 -32
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{klp-widget.controller-d8938377.js → klp-widget.controller-7a8a5ddc.js} +26 -2
- package/dist/cjs/{post-internet-header-7556c7d7.js → post-internet-header-72edf928.js} +4 -3
- package/dist/cjs/{post-klp-login-widget-0237ef6a.js → post-klp-login-widget-75dfc12f.js} +31 -1
- package/dist/cjs/post-klp-login-widget.cjs.entry.js +1 -1
- package/dist/cjs/swisspost-internet-header.cjs.entry.js +1 -1
- package/dist/collection/assets/js/klp-login-widget.js +26 -2
- package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.js +9 -3
- package/dist/collection/components/post-internet-header/post-internet-header.js +61 -15
- package/dist/collection/components/post-klp-login-widget/post-klp-login-widget.js +30 -0
- package/dist/components/focus-trap2.js +50 -32
- package/dist/components/klp-widget.controller.js +26 -2
- package/dist/components/post-klp-login-widget2.js +30 -0
- package/dist/components/swisspost-internet-header.js +4 -3
- package/dist/docs.json +120 -20
- package/dist/esm/focus-trap.entry.js +50 -32
- package/dist/esm/index.js +2 -2
- package/dist/esm/{klp-widget.controller-e635b42e.js → klp-widget.controller-6f5a7586.js} +26 -2
- package/dist/esm/{post-internet-header-e1b98bd6.js → post-internet-header-25cbaecc.js} +4 -3
- package/dist/esm/{post-klp-login-widget-0eadcd31.js → post-klp-login-widget-6aeb2fd2.js} +31 -1
- package/dist/esm/post-klp-login-widget.entry.js +1 -1
- package/dist/esm/swisspost-internet-header.entry.js +1 -1
- package/dist/esm-es5/focus-trap.entry.js +3 -3
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{klp-widget.controller-e635b42e.js → klp-widget.controller-6f5a7586.js} +2 -2
- package/dist/esm-es5/post-internet-header-25cbaecc.js +1 -0
- package/dist/esm-es5/{post-klp-login-widget-0eadcd31.js → post-klp-login-widget-6aeb2fd2.js} +1 -1
- package/dist/esm-es5/post-klp-login-widget.entry.js +1 -1
- package/dist/esm-es5/swisspost-internet-header.entry.js +1 -1
- package/dist/swisspost-internet-header/index.esm.js +1 -1
- package/dist/swisspost-internet-header/p-085d38af.entry.js +11 -0
- package/dist/swisspost-internet-header/{p-6e7f7a32.system.js → p-1d65df23.system.js} +1 -1
- package/dist/swisspost-internet-header/p-2aced2a4.entry.js +1 -0
- package/dist/swisspost-internet-header/{p-a14bbb6c.system.js → p-2ca95ddf.system.js} +1 -1
- package/dist/swisspost-internet-header/{p-d7bb8c4f.js → p-572ff7a8.js} +1 -1
- package/dist/swisspost-internet-header/p-5a806d1a.system.js +1 -0
- package/dist/swisspost-internet-header/p-695fe962.system.js +1 -1
- package/dist/swisspost-internet-header/{p-ed30835e.entry.js → p-935c52e3.entry.js} +1 -1
- package/dist/swisspost-internet-header/{p-45fcb989.system.js → p-9ba6f8b6.system.js} +1 -1
- package/dist/swisspost-internet-header/{p-dd01f7fe.js → p-9f6b64df.js} +1 -1
- package/dist/swisspost-internet-header/{p-4d5bddc5.system.entry.js → p-c45a080c.system.entry.js} +3 -3
- package/dist/swisspost-internet-header/p-cf4d8f82.js +1 -0
- package/dist/swisspost-internet-header/{p-28e2e93e.system.entry.js → p-df70d07e.system.entry.js} +1 -1
- package/dist/swisspost-internet-header/{p-095131e8.system.entry.js → p-eefdd3f5.system.entry.js} +1 -1
- package/dist/swisspost-internet-header/swisspost-internet-header.esm.js +1 -1
- package/dist/types/components/post-internet-breadcrumbs/post-internet-breadcrumbs.d.ts +3 -1
- package/dist/types/components/post-internet-header/post-internet-header.d.ts +16 -1
- package/dist/types/components/post-klp-login-widget/post-klp-login-widget.d.ts +3 -0
- package/dist/types/components.d.ts +37 -4
- package/package.json +3 -3
- package/dist/esm-es5/post-internet-header-e1b98bd6.js +0 -1
- package/dist/swisspost-internet-header/p-1be3e7c9.js +0 -1
- package/dist/swisspost-internet-header/p-810b3f48.system.js +0 -1
- package/dist/swisspost-internet-header/p-944e8412.entry.js +0 -11
- package/dist/swisspost-internet-header/p-b44980bc.entry.js +0 -1
|
@@ -33,6 +33,36 @@ export class PostKlpLoginWidget {
|
|
|
33
33
|
platform = Object.assign(Object.assign({}, platform), { selfAdminOrigin: this.selfAdminOrigin });
|
|
34
34
|
}
|
|
35
35
|
initializeKLPLoginWidget('post-klp-login-widget', Object.assign(Object.assign(Object.assign({}, widgetOptions), { environment: state.environment }), { platform }));
|
|
36
|
+
this.setupTracking();
|
|
37
|
+
}
|
|
38
|
+
setupTracking() {
|
|
39
|
+
var _a;
|
|
40
|
+
if (typeof window === 'undefined')
|
|
41
|
+
return;
|
|
42
|
+
window.dataLayer = window.dataLayer || [];
|
|
43
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.addEventListener('click', this.handleClick);
|
|
44
|
+
}
|
|
45
|
+
handleClick(event) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
const settingsLink = event
|
|
48
|
+
.composedPath()
|
|
49
|
+
.find(el => el instanceof HTMLAnchorElement && el.matches('#authenticated-menu a[href*="/settings"]'));
|
|
50
|
+
if (!settingsLink)
|
|
51
|
+
return;
|
|
52
|
+
const linkText = (_b = (_a = settingsLink
|
|
53
|
+
.querySelector('.klp-widget-notification-link-text')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
54
|
+
window.dataLayer.push({
|
|
55
|
+
event: 'select_menu',
|
|
56
|
+
type: 'authenticated_menu',
|
|
57
|
+
label: 'settings',
|
|
58
|
+
text: linkText,
|
|
59
|
+
link_url: settingsLink.href,
|
|
60
|
+
additional_info: '',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
disconnectedCallback() {
|
|
64
|
+
var _a;
|
|
65
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', this.handleClick);
|
|
36
66
|
}
|
|
37
67
|
/**
|
|
38
68
|
* Sets the focus on the login button
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
|
-
* tabbable 6.
|
|
4
|
+
* tabbable 6.4.0
|
|
5
5
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
6
6
|
*/
|
|
7
7
|
// NOTE: separate `:not()` selectors has broader browser support than the newer
|
|
8
8
|
// `:not([inert], [inert] *)` (Feb 2023)
|
|
9
|
-
|
|
10
|
-
// the entire query to fail, resulting in no nodes found, which will break a lot
|
|
11
|
-
// of things... so we have to rely on JS to identify nodes inside an inert container
|
|
12
|
-
var candidateSelectors = ['input:not([inert])', 'select:not([inert])', 'textarea:not([inert])', 'a[href]:not([inert])', 'button:not([inert])', '[tabindex]:not(slot):not([inert])', 'audio[controls]:not([inert])', 'video[controls]:not([inert])', '[contenteditable]:not([contenteditable="false"]):not([inert])', 'details>summary:first-of-type:not([inert])', 'details:not([inert])'];
|
|
9
|
+
var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)'];
|
|
13
10
|
var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
|
|
14
11
|
var NoElement = typeof Element === 'undefined';
|
|
15
12
|
var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
@@ -22,13 +19,13 @@ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (elemen
|
|
|
22
19
|
|
|
23
20
|
/**
|
|
24
21
|
* Determines if a node is inert or in an inert ancestor.
|
|
25
|
-
* @param {
|
|
22
|
+
* @param {Node} [node]
|
|
26
23
|
* @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
|
|
27
24
|
* see if any of them are inert. If false, only `node` itself is considered.
|
|
28
25
|
* @returns {boolean} True if inert itself or by way of being in an inert ancestor.
|
|
29
26
|
* False if `node` is falsy.
|
|
30
27
|
*/
|
|
31
|
-
var
|
|
28
|
+
var _isInert = function isInert(node, lookUp) {
|
|
32
29
|
var _node$getAttribute;
|
|
33
30
|
if (lookUp === void 0) {
|
|
34
31
|
lookUp = true;
|
|
@@ -42,10 +39,10 @@ var isInert = function isInert(node, lookUp) {
|
|
|
42
39
|
// NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
|
|
43
40
|
// if it weren't for `matches()` not being a function on shadow roots; the following
|
|
44
41
|
// code works for any kind of node
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
var result = inert || lookUp && node && (
|
|
43
|
+
// closest does not exist on shadow roots, so we fall back to a manual
|
|
44
|
+
// lookup upward, in case it is not defined.
|
|
45
|
+
typeof node.closest === 'function' ? node.closest('[inert]') : _isInert(node.parentNode));
|
|
49
46
|
return result;
|
|
50
47
|
};
|
|
51
48
|
|
|
@@ -71,8 +68,8 @@ var isContentEditable = function isContentEditable(node) {
|
|
|
71
68
|
*/
|
|
72
69
|
var getCandidates = function getCandidates(el, includeContainer, filter) {
|
|
73
70
|
// even if `includeContainer=false`, we still have to check it for inertness because
|
|
74
|
-
// if it's inert, all its children are inert
|
|
75
|
-
if (
|
|
71
|
+
// if it's inert (either by itself or via its parent), then all its children are inert
|
|
72
|
+
if (_isInert(el)) {
|
|
76
73
|
return [];
|
|
77
74
|
}
|
|
78
75
|
var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
|
|
@@ -117,12 +114,12 @@ var getCandidates = function getCandidates(el, includeContainer, filter) {
|
|
|
117
114
|
* @param {IterativeOptions} options
|
|
118
115
|
* @returns {Array.<Element|CandidateScope>}
|
|
119
116
|
*/
|
|
120
|
-
var
|
|
117
|
+
var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
|
|
121
118
|
var candidates = [];
|
|
122
119
|
var elementsToCheck = Array.from(elements);
|
|
123
120
|
while (elementsToCheck.length) {
|
|
124
121
|
var element = elementsToCheck.shift();
|
|
125
|
-
if (
|
|
122
|
+
if (_isInert(element, false)) {
|
|
126
123
|
// no need to look up since we're drilling down
|
|
127
124
|
// anything inside this container will also be inert
|
|
128
125
|
continue;
|
|
@@ -131,7 +128,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
131
128
|
// add shadow dom slot scope (slot itself cannot be focusable)
|
|
132
129
|
var assigned = element.assignedElements();
|
|
133
130
|
var content = assigned.length ? assigned : element.children;
|
|
134
|
-
var nestedCandidates =
|
|
131
|
+
var nestedCandidates = _getCandidatesIteratively(content, true, options);
|
|
135
132
|
if (options.flatten) {
|
|
136
133
|
candidates.push.apply(candidates, nestedCandidates);
|
|
137
134
|
} else {
|
|
@@ -155,7 +152,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
155
152
|
// no inert look up because we're already drilling down and checking for inertness
|
|
156
153
|
// on the way down, so all containers to this root node should have already been
|
|
157
154
|
// vetted as non-inert
|
|
158
|
-
var validShadowRoot = !
|
|
155
|
+
var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
|
|
159
156
|
if (shadowRoot && validShadowRoot) {
|
|
160
157
|
// add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
|
|
161
158
|
// shadow exists, so look at light dom children as fallback BUT create a scope for any
|
|
@@ -163,7 +160,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
163
160
|
// children of the web component element (which has the shadow), in the light dom, but
|
|
164
161
|
// slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
|
|
165
162
|
// _after_ we return from this recursive call
|
|
166
|
-
var _nestedCandidates =
|
|
163
|
+
var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
|
|
167
164
|
if (options.flatten) {
|
|
168
165
|
candidates.push.apply(candidates, _nestedCandidates);
|
|
169
166
|
} else {
|
|
@@ -340,6 +337,28 @@ var isZeroArea = function isZeroArea(node) {
|
|
|
340
337
|
var isHidden = function isHidden(node, _ref) {
|
|
341
338
|
var displayCheck = _ref.displayCheck,
|
|
342
339
|
getShadowRoot = _ref.getShadowRoot;
|
|
340
|
+
if (displayCheck === 'full-native') {
|
|
341
|
+
if ('checkVisibility' in node) {
|
|
342
|
+
// Chrome >= 105, Edge >= 105, Firefox >= 106, Safari >= 17.4
|
|
343
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility#browser_compatibility
|
|
344
|
+
var visible = node.checkVisibility({
|
|
345
|
+
// Checking opacity might be desirable for some use cases, but natively,
|
|
346
|
+
// opacity zero elements _are_ focusable and tabbable.
|
|
347
|
+
checkOpacity: false,
|
|
348
|
+
opacityProperty: false,
|
|
349
|
+
contentVisibilityAuto: true,
|
|
350
|
+
visibilityProperty: true,
|
|
351
|
+
// This is an alias for `visibilityProperty`. Contemporary browsers
|
|
352
|
+
// support both. However, this alias has wider browser support (Chrome
|
|
353
|
+
// >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
|
|
354
|
+
// we include it anyway.
|
|
355
|
+
checkVisibilityCSS: true
|
|
356
|
+
});
|
|
357
|
+
return !visible;
|
|
358
|
+
}
|
|
359
|
+
// Fall through to manual visibility checks
|
|
360
|
+
}
|
|
361
|
+
|
|
343
362
|
// NOTE: visibility will be `undefined` if node is detached from the document
|
|
344
363
|
// (see notes about this further down), which means we will consider it visible
|
|
345
364
|
// (this is legacy behavior from a very long way back)
|
|
@@ -353,7 +372,10 @@ var isHidden = function isHidden(node, _ref) {
|
|
|
353
372
|
if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
|
|
354
373
|
return true;
|
|
355
374
|
}
|
|
356
|
-
if (!displayCheck || displayCheck === 'full' ||
|
|
375
|
+
if (!displayCheck || displayCheck === 'full' ||
|
|
376
|
+
// full-native can run this branch when it falls through in case
|
|
377
|
+
// Element#checkVisibility is unsupported
|
|
378
|
+
displayCheck === 'full-native' || displayCheck === 'legacy-full') {
|
|
357
379
|
if (typeof getShadowRoot === 'function') {
|
|
358
380
|
// figure out if we should consider the node to be in an undisclosed shadow and use the
|
|
359
381
|
// 'non-zero-area' fallback
|
|
@@ -462,11 +484,7 @@ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
|
|
|
462
484
|
return false;
|
|
463
485
|
};
|
|
464
486
|
var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
|
|
465
|
-
if (node.disabled ||
|
|
466
|
-
// we must do an inert look up to filter out any elements inside an inert ancestor
|
|
467
|
-
// because we're limited in the type of selectors we can use in JSDom (see related
|
|
468
|
-
// note related to `candidateSelectors`)
|
|
469
|
-
isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
|
|
487
|
+
if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||
|
|
470
488
|
// For a details element with a summary, the summary element gets the focus
|
|
471
489
|
isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
|
|
472
490
|
return false;
|
|
@@ -479,7 +497,7 @@ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(opt
|
|
|
479
497
|
}
|
|
480
498
|
return true;
|
|
481
499
|
};
|
|
482
|
-
var
|
|
500
|
+
var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) {
|
|
483
501
|
var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
|
|
484
502
|
if (isNaN(tabIndex) || tabIndex >= 0) {
|
|
485
503
|
return true;
|
|
@@ -493,14 +511,14 @@ var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNod
|
|
|
493
511
|
* @param {Array.<Element|CandidateScope>} candidates
|
|
494
512
|
* @returns Element[]
|
|
495
513
|
*/
|
|
496
|
-
var
|
|
514
|
+
var _sortByOrder = function sortByOrder(candidates) {
|
|
497
515
|
var regularTabbables = [];
|
|
498
516
|
var orderedTabbables = [];
|
|
499
517
|
candidates.forEach(function (item, i) {
|
|
500
518
|
var isScope = !!item.scopeParent;
|
|
501
519
|
var element = isScope ? item.scopeParent : item;
|
|
502
520
|
var candidateTabindex = getSortOrderTabIndex(element, isScope);
|
|
503
|
-
var elements = isScope ?
|
|
521
|
+
var elements = isScope ? _sortByOrder(item.candidates) : element;
|
|
504
522
|
if (candidateTabindex === 0) {
|
|
505
523
|
isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
|
|
506
524
|
} else {
|
|
@@ -522,22 +540,22 @@ var tabbable = function tabbable(container, options) {
|
|
|
522
540
|
options = options || {};
|
|
523
541
|
var candidates;
|
|
524
542
|
if (options.getShadowRoot) {
|
|
525
|
-
candidates =
|
|
543
|
+
candidates = _getCandidatesIteratively([container], options.includeContainer, {
|
|
526
544
|
filter: isNodeMatchingSelectorTabbable.bind(null, options),
|
|
527
545
|
flatten: false,
|
|
528
546
|
getShadowRoot: options.getShadowRoot,
|
|
529
|
-
shadowRootFilter:
|
|
547
|
+
shadowRootFilter: isShadowRootTabbable
|
|
530
548
|
});
|
|
531
549
|
} else {
|
|
532
550
|
candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
|
|
533
551
|
}
|
|
534
|
-
return
|
|
552
|
+
return _sortByOrder(candidates);
|
|
535
553
|
};
|
|
536
554
|
var focusable = function focusable(container, options) {
|
|
537
555
|
options = options || {};
|
|
538
556
|
var candidates;
|
|
539
557
|
if (options.getShadowRoot) {
|
|
540
|
-
candidates =
|
|
558
|
+
candidates = _getCandidatesIteratively([container], options.includeContainer, {
|
|
541
559
|
filter: isNodeMatchingSelectorFocusable.bind(null, options),
|
|
542
560
|
flatten: true,
|
|
543
561
|
getShadowRoot: options.getShadowRoot
|
|
@@ -557,7 +575,7 @@ var isTabbable = function isTabbable(node, options) {
|
|
|
557
575
|
}
|
|
558
576
|
return isNodeMatchingSelectorTabbable(options, node);
|
|
559
577
|
};
|
|
560
|
-
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
|
|
578
|
+
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe:not([inert]):not([inert] *)').join(',');
|
|
561
579
|
var isFocusable = function isFocusable(node, options) {
|
|
562
580
|
options = options || {};
|
|
563
581
|
if (!node) {
|
|
@@ -14309,6 +14309,7 @@ const vertx = window.vertx || {};
|
|
|
14309
14309
|
}
|
|
14310
14310
|
}
|
|
14311
14311
|
|
|
14312
|
+
|
|
14312
14313
|
function audit(message) {
|
|
14313
14314
|
const auditingEvent = JSON.stringify({
|
|
14314
14315
|
adr: address,
|
|
@@ -15217,6 +15218,12 @@ const vertx = window.vertx || {};
|
|
|
15217
15218
|
if (!address) {
|
|
15218
15219
|
if (trySubscription()) {
|
|
15219
15220
|
log('Subscribing to get an address');
|
|
15221
|
+
if (globalThis.console && globalThis.console.info) {
|
|
15222
|
+
console.info('[klp-login-widget] subscribe attempt', {
|
|
15223
|
+
hasNctrl: document.cookie.includes(controlCookieName + '='),
|
|
15224
|
+
userAgent: navigator.userAgent,
|
|
15225
|
+
});
|
|
15226
|
+
}
|
|
15220
15227
|
const startTime = new Date().getTime();
|
|
15221
15228
|
fetch(platformEndPoints.subscribe, {
|
|
15222
15229
|
method: 'GET',
|
|
@@ -15227,8 +15234,25 @@ const vertx = window.vertx || {};
|
|
|
15227
15234
|
.then(message => handleMessage(message))
|
|
15228
15235
|
.catch(error => {
|
|
15229
15236
|
log('Failed to subscribe: ' + error.message);
|
|
15230
|
-
|
|
15231
|
-
|
|
15237
|
+
if (globalThis.console && globalThis.console.warn) {
|
|
15238
|
+
console.warn('[klp-login-widget] subscribe failed', {
|
|
15239
|
+
errorType: error.constructor ? error.constructor.name : typeof error,
|
|
15240
|
+
errorMessage: error.message,
|
|
15241
|
+
isTypeError: error instanceof TypeError,
|
|
15242
|
+
hasNctrl: document.cookie.includes(controlCookieName + '='),
|
|
15243
|
+
userAgent: navigator.userAgent,
|
|
15244
|
+
url: globalThis.location.href,
|
|
15245
|
+
});
|
|
15246
|
+
}
|
|
15247
|
+
if (error instanceof TypeError) {
|
|
15248
|
+
// Fetch cancelled by browser navigation, not an auth failure.
|
|
15249
|
+
// Do not call logout(): this would delete NCTRL and prevent recovery.
|
|
15250
|
+
log('Subscribe cancelled by navigation: preserving NCTRL, skipping logout.');
|
|
15251
|
+
renderWidget();
|
|
15252
|
+
} else {
|
|
15253
|
+
logout();
|
|
15254
|
+
renderWidget();
|
|
15255
|
+
}
|
|
15232
15256
|
});
|
|
15233
15257
|
logPerformanceMetric('subscribe()', new Date().getTime() - startTime);
|
|
15234
15258
|
} else {
|
|
@@ -40,6 +40,36 @@ const PostKlpLoginWidget = /*@__PURE__*/ proxyCustomElement(class PostKlpLoginWi
|
|
|
40
40
|
platform = Object.assign(Object.assign({}, platform), { selfAdminOrigin: this.selfAdminOrigin });
|
|
41
41
|
}
|
|
42
42
|
initializeKLPLoginWidget('post-klp-login-widget', Object.assign(Object.assign(Object.assign({}, widgetOptions), { environment: state.environment }), { platform }));
|
|
43
|
+
this.setupTracking();
|
|
44
|
+
}
|
|
45
|
+
setupTracking() {
|
|
46
|
+
var _a;
|
|
47
|
+
if (typeof window === 'undefined')
|
|
48
|
+
return;
|
|
49
|
+
window.dataLayer = window.dataLayer || [];
|
|
50
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.addEventListener('click', this.handleClick);
|
|
51
|
+
}
|
|
52
|
+
handleClick(event) {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
const settingsLink = event
|
|
55
|
+
.composedPath()
|
|
56
|
+
.find(el => el instanceof HTMLAnchorElement && el.matches('#authenticated-menu a[href*="/settings"]'));
|
|
57
|
+
if (!settingsLink)
|
|
58
|
+
return;
|
|
59
|
+
const linkText = (_b = (_a = settingsLink
|
|
60
|
+
.querySelector('.klp-widget-notification-link-text')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
61
|
+
window.dataLayer.push({
|
|
62
|
+
event: 'select_menu',
|
|
63
|
+
type: 'authenticated_menu',
|
|
64
|
+
label: 'settings',
|
|
65
|
+
text: linkText,
|
|
66
|
+
link_url: settingsLink.href,
|
|
67
|
+
additional_info: '',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
disconnectedCallback() {
|
|
71
|
+
var _a;
|
|
72
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', this.handleClick);
|
|
43
73
|
}
|
|
44
74
|
/**
|
|
45
75
|
* Sets the focus on the login button
|
|
@@ -378,7 +378,7 @@ const setMainNavigationIds = (navMainEntities) => {
|
|
|
378
378
|
};
|
|
379
379
|
|
|
380
380
|
const name = "@swisspost/internet-header";
|
|
381
|
-
const version = "1.
|
|
381
|
+
const version = "1.16.0";
|
|
382
382
|
const description = "The header for client facing applications.";
|
|
383
383
|
const author = "Swiss Post <design-system@post.ch>";
|
|
384
384
|
const license = "Apache-2.0";
|
|
@@ -419,7 +419,7 @@ const scripts = {
|
|
|
419
419
|
generate: "stencil generate"
|
|
420
420
|
};
|
|
421
421
|
const dependencies = {
|
|
422
|
-
"@swisspost/design-system-styles": "workspace:9.
|
|
422
|
+
"@swisspost/design-system-styles": "workspace:9.7.0",
|
|
423
423
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
424
424
|
"iframe-resizer": "4.4.5",
|
|
425
425
|
jquery: "3.7.1",
|
|
@@ -458,7 +458,7 @@ const devDependencies = {
|
|
|
458
458
|
sass: "1.77.8",
|
|
459
459
|
"start-server-and-test": "2.0.5",
|
|
460
460
|
"ts-jest": "29.2.4",
|
|
461
|
-
typescript: "5.
|
|
461
|
+
typescript: "5.9.3"
|
|
462
462
|
};
|
|
463
463
|
const keywords = [
|
|
464
464
|
"components",
|
|
@@ -589,6 +589,7 @@ const PostInternetHeader = /*@__PURE__*/ proxyCustomElement(class PostInternetHe
|
|
|
589
589
|
/**
|
|
590
590
|
* Get the currently set language as a two letter string ("de", "fr" "it" or "en")
|
|
591
591
|
* @returns string
|
|
592
|
+
* @deprecated use `document.documentElement.lang` instead
|
|
592
593
|
*/
|
|
593
594
|
async getCurrentLanguage() {
|
|
594
595
|
var _a;
|
package/dist/docs.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "
|
|
2
|
+
"timestamp": "2026-02-23T18:09:42",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.19.2",
|
|
@@ -749,8 +749,14 @@
|
|
|
749
749
|
"mutable": false,
|
|
750
750
|
"attr": "custom-items",
|
|
751
751
|
"reflectToAttr": false,
|
|
752
|
-
"docs": "Add custom breadcrumb items to the end of the pre-configured list. Handy if your online service has
|
|
753
|
-
"docsTags": [
|
|
752
|
+
"docs": "Add custom breadcrumb items to the end of the pre-configured list. Handy if your online service has its own navigation structure.",
|
|
753
|
+
"docsTags": [
|
|
754
|
+
{
|
|
755
|
+
"name": "deprecated",
|
|
756
|
+
"text": "overlays will no longer be provided in the next major release, therefore this method will no longer be needed."
|
|
757
|
+
}
|
|
758
|
+
],
|
|
759
|
+
"deprecation": "overlays will no longer be provided in the next major release, therefore this method will no longer be needed.",
|
|
754
760
|
"values": [
|
|
755
761
|
{
|
|
756
762
|
"type": "IBreadcrumbItem[]"
|
|
@@ -777,8 +783,14 @@
|
|
|
777
783
|
"attr": "hide-buttons",
|
|
778
784
|
"reflectToAttr": false,
|
|
779
785
|
"docs": "Hide all buttons.",
|
|
780
|
-
"docsTags": [
|
|
786
|
+
"docsTags": [
|
|
787
|
+
{
|
|
788
|
+
"name": "deprecated",
|
|
789
|
+
"text": "Help and Contact buttons will no longer be provided in the next major release, therefore this prop will no longer be needed."
|
|
790
|
+
}
|
|
791
|
+
],
|
|
781
792
|
"default": "false",
|
|
793
|
+
"deprecation": "Help and Contact buttons will no longer be provided in the next major release, therefore this prop will no longer be needed.",
|
|
782
794
|
"values": [
|
|
783
795
|
{
|
|
784
796
|
"type": "boolean"
|
|
@@ -889,8 +901,14 @@
|
|
|
889
901
|
"attr": "active-route",
|
|
890
902
|
"reflectToAttr": false,
|
|
891
903
|
"docs": "Set the currently activated route. If there is a link matching this URL in the header, it will be highlighted.\nWill also highlight partly matching URLs. When set to auto, will use current location.href for comparison.",
|
|
892
|
-
"docsTags": [
|
|
904
|
+
"docsTags": [
|
|
905
|
+
{
|
|
906
|
+
"name": "deprecated",
|
|
907
|
+
"text": "boolean values will no longer be accepted in the next major release. Use \"none\" for false and \"auto\" for true. All other values remain unchanged."
|
|
908
|
+
}
|
|
909
|
+
],
|
|
893
910
|
"default": "'auto'",
|
|
911
|
+
"deprecation": "boolean values will no longer be accepted in the next major release. Use \"none\" for false and \"auto\" for true. All other values remain unchanged.",
|
|
894
912
|
"values": [
|
|
895
913
|
{
|
|
896
914
|
"type": "boolean"
|
|
@@ -916,8 +934,14 @@
|
|
|
916
934
|
"mutable": false,
|
|
917
935
|
"attr": "config-proxy",
|
|
918
936
|
"reflectToAttr": false,
|
|
919
|
-
"docs": "
|
|
920
|
-
"docsTags": [
|
|
937
|
+
"docs": "Define a proxy URL for the config fetch request.",
|
|
938
|
+
"docsTags": [
|
|
939
|
+
{
|
|
940
|
+
"name": "deprecated",
|
|
941
|
+
"text": "this functionality will no longer be provided in the next major release and was deprecated previously."
|
|
942
|
+
}
|
|
943
|
+
],
|
|
944
|
+
"deprecation": "this functionality will no longer be provided in the next major release and was deprecated previously.",
|
|
921
945
|
"values": [
|
|
922
946
|
{
|
|
923
947
|
"type": "string"
|
|
@@ -947,7 +971,13 @@
|
|
|
947
971
|
"attr": "custom-config",
|
|
948
972
|
"reflectToAttr": false,
|
|
949
973
|
"docs": "Customize the header config loaded from the post portal.",
|
|
950
|
-
"docsTags": [
|
|
974
|
+
"docsTags": [
|
|
975
|
+
{
|
|
976
|
+
"name": "deprecated",
|
|
977
|
+
"text": "use the main navigation slot to add custom menu entries. This option will be removed in the next major release."
|
|
978
|
+
}
|
|
979
|
+
],
|
|
980
|
+
"deprecation": "use the main navigation slot to add custom menu entries. This option will be removed in the next major release.",
|
|
951
981
|
"values": [
|
|
952
982
|
{
|
|
953
983
|
"type": "ICustomConfig"
|
|
@@ -1089,7 +1119,13 @@
|
|
|
1089
1119
|
"attr": "language-cookie-key",
|
|
1090
1120
|
"reflectToAttr": false,
|
|
1091
1121
|
"docs": "The header uses this cookie to set the language. Disables automatic language detection.",
|
|
1092
|
-
"docsTags": [
|
|
1122
|
+
"docsTags": [
|
|
1123
|
+
{
|
|
1124
|
+
"name": "deprecated",
|
|
1125
|
+
"text": "this will no longer be supported in the next major release due to low usage, in favor of a project-specific solution."
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
"deprecation": "this will no longer be supported in the next major release due to low usage, in favor of a project-specific solution.",
|
|
1093
1129
|
"values": [
|
|
1094
1130
|
{
|
|
1095
1131
|
"type": "string"
|
|
@@ -1113,8 +1149,14 @@
|
|
|
1113
1149
|
"attr": "language-local-storage-key",
|
|
1114
1150
|
"reflectToAttr": false,
|
|
1115
1151
|
"docs": "The header uses this local storage key to set the language. Disables automatic language selection.",
|
|
1116
|
-
"docsTags": [
|
|
1152
|
+
"docsTags": [
|
|
1153
|
+
{
|
|
1154
|
+
"name": "deprecated",
|
|
1155
|
+
"text": "this will no longer be supported in the next major release due to low usage, in favor of a project-specific solution."
|
|
1156
|
+
}
|
|
1157
|
+
],
|
|
1117
1158
|
"default": "'swisspost-internet-header-language'",
|
|
1159
|
+
"deprecation": "this will no longer be supported in the next major release due to low usage, in favor of a project-specific solution.",
|
|
1118
1160
|
"values": [
|
|
1119
1161
|
{
|
|
1120
1162
|
"type": "string"
|
|
@@ -1144,7 +1186,13 @@
|
|
|
1144
1186
|
"attr": "language-switch-overrides",
|
|
1145
1187
|
"reflectToAttr": false,
|
|
1146
1188
|
"docs": "Override the language switch links with custom URLs. Helpful when your application contains sub-pages, and you\nwould like to stay on subpages when the user changes language.",
|
|
1147
|
-
"docsTags": [
|
|
1189
|
+
"docsTags": [
|
|
1190
|
+
{
|
|
1191
|
+
"name": "deprecated",
|
|
1192
|
+
"text": "use the language menu slot to override the language switch and specify custom URLs. This option will be removed in the next major release."
|
|
1193
|
+
}
|
|
1194
|
+
],
|
|
1195
|
+
"deprecation": "use the language menu slot to override the language switch and specify custom URLs. This option will be removed in the next major release.",
|
|
1148
1196
|
"values": [
|
|
1149
1197
|
{
|
|
1150
1198
|
"type": "IAvailableLanguage[]"
|
|
@@ -1171,8 +1219,14 @@
|
|
|
1171
1219
|
"attr": "login",
|
|
1172
1220
|
"reflectToAttr": false,
|
|
1173
1221
|
"docs": "Toggle the login link (when logged out) or the user widget (when logged in).",
|
|
1174
|
-
"docsTags": [
|
|
1222
|
+
"docsTags": [
|
|
1223
|
+
{
|
|
1224
|
+
"name": "deprecated",
|
|
1225
|
+
"text": "use the new configuration API to show or hide the login. This option will be removed in the next major release."
|
|
1226
|
+
}
|
|
1227
|
+
],
|
|
1175
1228
|
"default": "true",
|
|
1229
|
+
"deprecation": "use the new configuration API to show or hide the login. This option will be removed in the next major release.",
|
|
1176
1230
|
"values": [
|
|
1177
1231
|
{
|
|
1178
1232
|
"type": "boolean"
|
|
@@ -1193,7 +1247,13 @@
|
|
|
1193
1247
|
"attr": "logout-url",
|
|
1194
1248
|
"reflectToAttr": false,
|
|
1195
1249
|
"docs": "Overrides the logout-url provided by the portal config.",
|
|
1196
|
-
"docsTags": [
|
|
1250
|
+
"docsTags": [
|
|
1251
|
+
{
|
|
1252
|
+
"name": "deprecated",
|
|
1253
|
+
"text": "use the new configuration API to specify the logout URL. This option will be removed in the next major release."
|
|
1254
|
+
}
|
|
1255
|
+
],
|
|
1256
|
+
"deprecation": "use the new configuration API to specify the logout URL. This option will be removed in the next major release.",
|
|
1197
1257
|
"values": [
|
|
1198
1258
|
{
|
|
1199
1259
|
"type": "string"
|
|
@@ -1217,8 +1277,14 @@
|
|
|
1217
1277
|
"attr": "meta",
|
|
1218
1278
|
"reflectToAttr": false,
|
|
1219
1279
|
"docs": "Toggle the meta navigation.",
|
|
1220
|
-
"docsTags": [
|
|
1280
|
+
"docsTags": [
|
|
1281
|
+
{
|
|
1282
|
+
"name": "deprecated",
|
|
1283
|
+
"text": "use the new configuration API to show or hide the meta navigation links. This option will be removed in the next major release."
|
|
1284
|
+
}
|
|
1285
|
+
],
|
|
1221
1286
|
"default": "true",
|
|
1287
|
+
"deprecation": "use the new configuration API to show or hide the meta navigation links. This option will be removed in the next major release.",
|
|
1222
1288
|
"values": [
|
|
1223
1289
|
{
|
|
1224
1290
|
"type": "boolean"
|
|
@@ -1245,7 +1311,12 @@
|
|
|
1245
1311
|
"attr": "os-flyout-overrides",
|
|
1246
1312
|
"reflectToAttr": false,
|
|
1247
1313
|
"docs": "Online Services only: Add custom links to the special online service navigation entry",
|
|
1248
|
-
"docsTags": [
|
|
1314
|
+
"docsTags": [
|
|
1315
|
+
{
|
|
1316
|
+
"name": "deprecatedthe",
|
|
1317
|
+
"text": "new header will no longer include this flyout in the next major release. Use the main navigation slot to add application-specific menu items."
|
|
1318
|
+
}
|
|
1319
|
+
],
|
|
1249
1320
|
"values": [
|
|
1250
1321
|
{
|
|
1251
1322
|
"type": "NavMainEntity"
|
|
@@ -1293,8 +1364,14 @@
|
|
|
1293
1364
|
"attr": "search",
|
|
1294
1365
|
"reflectToAttr": false,
|
|
1295
1366
|
"docs": "Toggle the search button.",
|
|
1296
|
-
"docsTags": [
|
|
1367
|
+
"docsTags": [
|
|
1368
|
+
{
|
|
1369
|
+
"name": "deprecated",
|
|
1370
|
+
"text": "use the new configuration API to show or hide the search. This option will be removed in the next major release."
|
|
1371
|
+
}
|
|
1372
|
+
],
|
|
1297
1373
|
"default": "true",
|
|
1374
|
+
"deprecation": "use the new configuration API to show or hide the search. This option will be removed in the next major release.",
|
|
1298
1375
|
"values": [
|
|
1299
1376
|
{
|
|
1300
1377
|
"type": "boolean"
|
|
@@ -1315,7 +1392,13 @@
|
|
|
1315
1392
|
"attr": "self-admin-origin",
|
|
1316
1393
|
"reflectToAttr": false,
|
|
1317
1394
|
"docs": "Overrides the selfadmin url in case it needs to differ from the logoutUrl, which is the url that is used by default.\nThe selfadmin url is used in the KLP login widget to set the user menu links.",
|
|
1318
|
-
"docsTags": [
|
|
1395
|
+
"docsTags": [
|
|
1396
|
+
{
|
|
1397
|
+
"name": "deprecated",
|
|
1398
|
+
"text": "use the new configuration API to specify these URLs. This option will be removed in the next major release."
|
|
1399
|
+
}
|
|
1400
|
+
],
|
|
1401
|
+
"deprecation": "use the new configuration API to specify these URLs. This option will be removed in the next major release.",
|
|
1319
1402
|
"values": [
|
|
1320
1403
|
{
|
|
1321
1404
|
"type": "string"
|
|
@@ -1339,8 +1422,14 @@
|
|
|
1339
1422
|
"attr": "skiplinks",
|
|
1340
1423
|
"reflectToAttr": false,
|
|
1341
1424
|
"docs": "Toggle skiplinks. They help keyboard users to quickly jump to important sections of the page.",
|
|
1342
|
-
"docsTags": [
|
|
1425
|
+
"docsTags": [
|
|
1426
|
+
{
|
|
1427
|
+
"name": "deprecated",
|
|
1428
|
+
"text": "please implement the skiplinks component. This option will be removed in the next major release."
|
|
1429
|
+
}
|
|
1430
|
+
],
|
|
1343
1431
|
"default": "true",
|
|
1432
|
+
"deprecation": "please implement the skiplinks component. This option will be removed in the next major release.",
|
|
1344
1433
|
"values": [
|
|
1345
1434
|
{
|
|
1346
1435
|
"type": "boolean"
|
|
@@ -1367,8 +1456,14 @@
|
|
|
1367
1456
|
"attr": "stickyness",
|
|
1368
1457
|
"reflectToAttr": false,
|
|
1369
1458
|
"docs": "Sticky behaviour of the header.",
|
|
1370
|
-
"docsTags": [
|
|
1459
|
+
"docsTags": [
|
|
1460
|
+
{
|
|
1461
|
+
"name": "deprecated",
|
|
1462
|
+
"text": "this option will no longer be configurable with the new header in the next major release."
|
|
1463
|
+
}
|
|
1464
|
+
],
|
|
1371
1465
|
"default": "'minimal'",
|
|
1466
|
+
"deprecation": "this option will no longer be configurable with the new header in the next major release.",
|
|
1372
1467
|
"values": [
|
|
1373
1468
|
{
|
|
1374
1469
|
"value": "full",
|
|
@@ -1416,8 +1511,13 @@
|
|
|
1416
1511
|
{
|
|
1417
1512
|
"name": "returns",
|
|
1418
1513
|
"text": "string"
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
"name": "deprecated",
|
|
1517
|
+
"text": "use `document.documentElement.lang` instead"
|
|
1419
1518
|
}
|
|
1420
|
-
]
|
|
1519
|
+
],
|
|
1520
|
+
"deprecation": "use `document.documentElement.lang` instead"
|
|
1421
1521
|
}
|
|
1422
1522
|
],
|
|
1423
1523
|
"events": [
|