@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
|
@@ -5,15 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-ecd8c9bb.js');
|
|
6
6
|
|
|
7
7
|
/*!
|
|
8
|
-
* tabbable 6.
|
|
8
|
+
* tabbable 6.4.0
|
|
9
9
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
10
10
|
*/
|
|
11
11
|
// NOTE: separate `:not()` selectors has broader browser support than the newer
|
|
12
12
|
// `:not([inert], [inert] *)` (Feb 2023)
|
|
13
|
-
|
|
14
|
-
// the entire query to fail, resulting in no nodes found, which will break a lot
|
|
15
|
-
// of things... so we have to rely on JS to identify nodes inside an inert container
|
|
16
|
-
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])'];
|
|
13
|
+
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] *)'];
|
|
17
14
|
var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
|
|
18
15
|
var NoElement = typeof Element === 'undefined';
|
|
19
16
|
var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
@@ -26,13 +23,13 @@ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (elemen
|
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
25
|
* Determines if a node is inert or in an inert ancestor.
|
|
29
|
-
* @param {
|
|
26
|
+
* @param {Node} [node]
|
|
30
27
|
* @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
|
|
31
28
|
* see if any of them are inert. If false, only `node` itself is considered.
|
|
32
29
|
* @returns {boolean} True if inert itself or by way of being in an inert ancestor.
|
|
33
30
|
* False if `node` is falsy.
|
|
34
31
|
*/
|
|
35
|
-
var
|
|
32
|
+
var _isInert = function isInert(node, lookUp) {
|
|
36
33
|
var _node$getAttribute;
|
|
37
34
|
if (lookUp === void 0) {
|
|
38
35
|
lookUp = true;
|
|
@@ -46,10 +43,10 @@ var isInert = function isInert(node, lookUp) {
|
|
|
46
43
|
// NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
|
|
47
44
|
// if it weren't for `matches()` not being a function on shadow roots; the following
|
|
48
45
|
// code works for any kind of node
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
var result = inert || lookUp && node && (
|
|
47
|
+
// closest does not exist on shadow roots, so we fall back to a manual
|
|
48
|
+
// lookup upward, in case it is not defined.
|
|
49
|
+
typeof node.closest === 'function' ? node.closest('[inert]') : _isInert(node.parentNode));
|
|
53
50
|
return result;
|
|
54
51
|
};
|
|
55
52
|
|
|
@@ -75,8 +72,8 @@ var isContentEditable = function isContentEditable(node) {
|
|
|
75
72
|
*/
|
|
76
73
|
var getCandidates = function getCandidates(el, includeContainer, filter) {
|
|
77
74
|
// even if `includeContainer=false`, we still have to check it for inertness because
|
|
78
|
-
// if it's inert, all its children are inert
|
|
79
|
-
if (
|
|
75
|
+
// if it's inert (either by itself or via its parent), then all its children are inert
|
|
76
|
+
if (_isInert(el)) {
|
|
80
77
|
return [];
|
|
81
78
|
}
|
|
82
79
|
var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
|
|
@@ -121,12 +118,12 @@ var getCandidates = function getCandidates(el, includeContainer, filter) {
|
|
|
121
118
|
* @param {IterativeOptions} options
|
|
122
119
|
* @returns {Array.<Element|CandidateScope>}
|
|
123
120
|
*/
|
|
124
|
-
var
|
|
121
|
+
var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
|
|
125
122
|
var candidates = [];
|
|
126
123
|
var elementsToCheck = Array.from(elements);
|
|
127
124
|
while (elementsToCheck.length) {
|
|
128
125
|
var element = elementsToCheck.shift();
|
|
129
|
-
if (
|
|
126
|
+
if (_isInert(element, false)) {
|
|
130
127
|
// no need to look up since we're drilling down
|
|
131
128
|
// anything inside this container will also be inert
|
|
132
129
|
continue;
|
|
@@ -135,7 +132,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
135
132
|
// add shadow dom slot scope (slot itself cannot be focusable)
|
|
136
133
|
var assigned = element.assignedElements();
|
|
137
134
|
var content = assigned.length ? assigned : element.children;
|
|
138
|
-
var nestedCandidates =
|
|
135
|
+
var nestedCandidates = _getCandidatesIteratively(content, true, options);
|
|
139
136
|
if (options.flatten) {
|
|
140
137
|
candidates.push.apply(candidates, nestedCandidates);
|
|
141
138
|
} else {
|
|
@@ -159,7 +156,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
159
156
|
// no inert look up because we're already drilling down and checking for inertness
|
|
160
157
|
// on the way down, so all containers to this root node should have already been
|
|
161
158
|
// vetted as non-inert
|
|
162
|
-
var validShadowRoot = !
|
|
159
|
+
var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
|
|
163
160
|
if (shadowRoot && validShadowRoot) {
|
|
164
161
|
// add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
|
|
165
162
|
// shadow exists, so look at light dom children as fallback BUT create a scope for any
|
|
@@ -167,7 +164,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
167
164
|
// children of the web component element (which has the shadow), in the light dom, but
|
|
168
165
|
// slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
|
|
169
166
|
// _after_ we return from this recursive call
|
|
170
|
-
var _nestedCandidates =
|
|
167
|
+
var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
|
|
171
168
|
if (options.flatten) {
|
|
172
169
|
candidates.push.apply(candidates, _nestedCandidates);
|
|
173
170
|
} else {
|
|
@@ -344,6 +341,28 @@ var isZeroArea = function isZeroArea(node) {
|
|
|
344
341
|
var isHidden = function isHidden(node, _ref) {
|
|
345
342
|
var displayCheck = _ref.displayCheck,
|
|
346
343
|
getShadowRoot = _ref.getShadowRoot;
|
|
344
|
+
if (displayCheck === 'full-native') {
|
|
345
|
+
if ('checkVisibility' in node) {
|
|
346
|
+
// Chrome >= 105, Edge >= 105, Firefox >= 106, Safari >= 17.4
|
|
347
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility#browser_compatibility
|
|
348
|
+
var visible = node.checkVisibility({
|
|
349
|
+
// Checking opacity might be desirable for some use cases, but natively,
|
|
350
|
+
// opacity zero elements _are_ focusable and tabbable.
|
|
351
|
+
checkOpacity: false,
|
|
352
|
+
opacityProperty: false,
|
|
353
|
+
contentVisibilityAuto: true,
|
|
354
|
+
visibilityProperty: true,
|
|
355
|
+
// This is an alias for `visibilityProperty`. Contemporary browsers
|
|
356
|
+
// support both. However, this alias has wider browser support (Chrome
|
|
357
|
+
// >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
|
|
358
|
+
// we include it anyway.
|
|
359
|
+
checkVisibilityCSS: true
|
|
360
|
+
});
|
|
361
|
+
return !visible;
|
|
362
|
+
}
|
|
363
|
+
// Fall through to manual visibility checks
|
|
364
|
+
}
|
|
365
|
+
|
|
347
366
|
// NOTE: visibility will be `undefined` if node is detached from the document
|
|
348
367
|
// (see notes about this further down), which means we will consider it visible
|
|
349
368
|
// (this is legacy behavior from a very long way back)
|
|
@@ -357,7 +376,10 @@ var isHidden = function isHidden(node, _ref) {
|
|
|
357
376
|
if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
|
|
358
377
|
return true;
|
|
359
378
|
}
|
|
360
|
-
if (!displayCheck || displayCheck === 'full' ||
|
|
379
|
+
if (!displayCheck || displayCheck === 'full' ||
|
|
380
|
+
// full-native can run this branch when it falls through in case
|
|
381
|
+
// Element#checkVisibility is unsupported
|
|
382
|
+
displayCheck === 'full-native' || displayCheck === 'legacy-full') {
|
|
361
383
|
if (typeof getShadowRoot === 'function') {
|
|
362
384
|
// figure out if we should consider the node to be in an undisclosed shadow and use the
|
|
363
385
|
// 'non-zero-area' fallback
|
|
@@ -466,11 +488,7 @@ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
|
|
|
466
488
|
return false;
|
|
467
489
|
};
|
|
468
490
|
var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
|
|
469
|
-
if (node.disabled ||
|
|
470
|
-
// we must do an inert look up to filter out any elements inside an inert ancestor
|
|
471
|
-
// because we're limited in the type of selectors we can use in JSDom (see related
|
|
472
|
-
// note related to `candidateSelectors`)
|
|
473
|
-
isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
|
|
491
|
+
if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||
|
|
474
492
|
// For a details element with a summary, the summary element gets the focus
|
|
475
493
|
isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
|
|
476
494
|
return false;
|
|
@@ -483,7 +501,7 @@ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(opt
|
|
|
483
501
|
}
|
|
484
502
|
return true;
|
|
485
503
|
};
|
|
486
|
-
var
|
|
504
|
+
var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) {
|
|
487
505
|
var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
|
|
488
506
|
if (isNaN(tabIndex) || tabIndex >= 0) {
|
|
489
507
|
return true;
|
|
@@ -497,14 +515,14 @@ var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNod
|
|
|
497
515
|
* @param {Array.<Element|CandidateScope>} candidates
|
|
498
516
|
* @returns Element[]
|
|
499
517
|
*/
|
|
500
|
-
var
|
|
518
|
+
var _sortByOrder = function sortByOrder(candidates) {
|
|
501
519
|
var regularTabbables = [];
|
|
502
520
|
var orderedTabbables = [];
|
|
503
521
|
candidates.forEach(function (item, i) {
|
|
504
522
|
var isScope = !!item.scopeParent;
|
|
505
523
|
var element = isScope ? item.scopeParent : item;
|
|
506
524
|
var candidateTabindex = getSortOrderTabIndex(element, isScope);
|
|
507
|
-
var elements = isScope ?
|
|
525
|
+
var elements = isScope ? _sortByOrder(item.candidates) : element;
|
|
508
526
|
if (candidateTabindex === 0) {
|
|
509
527
|
isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
|
|
510
528
|
} else {
|
|
@@ -526,22 +544,22 @@ var tabbable = function tabbable(container, options) {
|
|
|
526
544
|
options = options || {};
|
|
527
545
|
var candidates;
|
|
528
546
|
if (options.getShadowRoot) {
|
|
529
|
-
candidates =
|
|
547
|
+
candidates = _getCandidatesIteratively([container], options.includeContainer, {
|
|
530
548
|
filter: isNodeMatchingSelectorTabbable.bind(null, options),
|
|
531
549
|
flatten: false,
|
|
532
550
|
getShadowRoot: options.getShadowRoot,
|
|
533
|
-
shadowRootFilter:
|
|
551
|
+
shadowRootFilter: isShadowRootTabbable
|
|
534
552
|
});
|
|
535
553
|
} else {
|
|
536
554
|
candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
|
|
537
555
|
}
|
|
538
|
-
return
|
|
556
|
+
return _sortByOrder(candidates);
|
|
539
557
|
};
|
|
540
558
|
var focusable = function focusable(container, options) {
|
|
541
559
|
options = options || {};
|
|
542
560
|
var candidates;
|
|
543
561
|
if (options.getShadowRoot) {
|
|
544
|
-
candidates =
|
|
562
|
+
candidates = _getCandidatesIteratively([container], options.includeContainer, {
|
|
545
563
|
filter: isNodeMatchingSelectorFocusable.bind(null, options),
|
|
546
564
|
flatten: true,
|
|
547
565
|
getShadowRoot: options.getShadowRoot
|
|
@@ -561,7 +579,7 @@ var isTabbable = function isTabbable(node, options) {
|
|
|
561
579
|
}
|
|
562
580
|
return isNodeMatchingSelectorTabbable(options, node);
|
|
563
581
|
};
|
|
564
|
-
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
|
|
582
|
+
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe:not([inert]):not([inert] *)').join(',');
|
|
565
583
|
var isFocusable = function isFocusable(node, options) {
|
|
566
584
|
options = options || {};
|
|
567
585
|
if (!node) {
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postInternetHeader = require('./post-internet-header-
|
|
5
|
+
const postInternetHeader = require('./post-internet-header-72edf928.js');
|
|
6
6
|
const postInternetBreadcrumbs = require('./post-internet-breadcrumbs-6c043d02.js');
|
|
7
7
|
const postInternetFooter = require('./post-internet-footer-9e46e1fc.js');
|
|
8
8
|
const postSkiplinks = require('./post-skiplinks-469cc355.js');
|
|
@@ -11,7 +11,7 @@ const postLanguageSwitch = require('./post-language-switch-0730827b.js');
|
|
|
11
11
|
const postLogo = require('./post-logo-4c1f9387.js');
|
|
12
12
|
const postMainNavigation = require('./post-main-navigation-bd2473fb.js');
|
|
13
13
|
const postSearch = require('./post-search-1894421f.js');
|
|
14
|
-
const postKlpLoginWidget = require('./post-klp-login-widget-
|
|
14
|
+
const postKlpLoginWidget = require('./post-klp-login-widget-75dfc12f.js');
|
|
15
15
|
require('./index-ecd8c9bb.js');
|
|
16
16
|
require('./index-fbcc9ff3.js');
|
|
17
17
|
require('./language.service-15af0e29.js');
|
|
@@ -14311,6 +14311,7 @@ const vertx = window.vertx || {};
|
|
|
14311
14311
|
}
|
|
14312
14312
|
}
|
|
14313
14313
|
|
|
14314
|
+
|
|
14314
14315
|
function audit(message) {
|
|
14315
14316
|
const auditingEvent = JSON.stringify({
|
|
14316
14317
|
adr: address,
|
|
@@ -15219,6 +15220,12 @@ const vertx = window.vertx || {};
|
|
|
15219
15220
|
if (!address) {
|
|
15220
15221
|
if (trySubscription()) {
|
|
15221
15222
|
log('Subscribing to get an address');
|
|
15223
|
+
if (globalThis.console && globalThis.console.info) {
|
|
15224
|
+
console.info('[klp-login-widget] subscribe attempt', {
|
|
15225
|
+
hasNctrl: document.cookie.includes(controlCookieName + '='),
|
|
15226
|
+
userAgent: navigator.userAgent,
|
|
15227
|
+
});
|
|
15228
|
+
}
|
|
15222
15229
|
const startTime = new Date().getTime();
|
|
15223
15230
|
fetch(platformEndPoints.subscribe, {
|
|
15224
15231
|
method: 'GET',
|
|
@@ -15229,8 +15236,25 @@ const vertx = window.vertx || {};
|
|
|
15229
15236
|
.then(message => handleMessage(message))
|
|
15230
15237
|
.catch(error => {
|
|
15231
15238
|
log('Failed to subscribe: ' + error.message);
|
|
15232
|
-
|
|
15233
|
-
|
|
15239
|
+
if (globalThis.console && globalThis.console.warn) {
|
|
15240
|
+
console.warn('[klp-login-widget] subscribe failed', {
|
|
15241
|
+
errorType: error.constructor ? error.constructor.name : typeof error,
|
|
15242
|
+
errorMessage: error.message,
|
|
15243
|
+
isTypeError: error instanceof TypeError,
|
|
15244
|
+
hasNctrl: document.cookie.includes(controlCookieName + '='),
|
|
15245
|
+
userAgent: navigator.userAgent,
|
|
15246
|
+
url: globalThis.location.href,
|
|
15247
|
+
});
|
|
15248
|
+
}
|
|
15249
|
+
if (error instanceof TypeError) {
|
|
15250
|
+
// Fetch cancelled by browser navigation, not an auth failure.
|
|
15251
|
+
// Do not call logout(): this would delete NCTRL and prevent recovery.
|
|
15252
|
+
log('Subscribe cancelled by navigation: preserving NCTRL, skipping logout.');
|
|
15253
|
+
renderWidget();
|
|
15254
|
+
} else {
|
|
15255
|
+
logout();
|
|
15256
|
+
renderWidget();
|
|
15257
|
+
}
|
|
15234
15258
|
});
|
|
15235
15259
|
logPerformanceMetric('subscribe()', new Date().getTime() - startTime);
|
|
15236
15260
|
} else {
|
|
@@ -373,7 +373,7 @@ const setMainNavigationIds = (navMainEntities) => {
|
|
|
373
373
|
};
|
|
374
374
|
|
|
375
375
|
const name = "@swisspost/internet-header";
|
|
376
|
-
const version = "1.
|
|
376
|
+
const version = "1.16.0";
|
|
377
377
|
const description = "The header for client facing applications.";
|
|
378
378
|
const author = "Swiss Post <design-system@post.ch>";
|
|
379
379
|
const license = "Apache-2.0";
|
|
@@ -414,7 +414,7 @@ const scripts = {
|
|
|
414
414
|
generate: "stencil generate"
|
|
415
415
|
};
|
|
416
416
|
const dependencies = {
|
|
417
|
-
"@swisspost/design-system-styles": "workspace:9.
|
|
417
|
+
"@swisspost/design-system-styles": "workspace:9.7.0",
|
|
418
418
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
419
419
|
"iframe-resizer": "4.4.5",
|
|
420
420
|
jquery: "3.7.1",
|
|
@@ -453,7 +453,7 @@ const devDependencies = {
|
|
|
453
453
|
sass: "1.77.8",
|
|
454
454
|
"start-server-and-test": "2.0.5",
|
|
455
455
|
"ts-jest": "29.2.4",
|
|
456
|
-
typescript: "5.
|
|
456
|
+
typescript: "5.9.3"
|
|
457
457
|
};
|
|
458
458
|
const keywords = [
|
|
459
459
|
"components",
|
|
@@ -584,6 +584,7 @@ const PostInternetHeader = class {
|
|
|
584
584
|
/**
|
|
585
585
|
* Get the currently set language as a two letter string ("de", "fr" "it" or "en")
|
|
586
586
|
* @returns string
|
|
587
|
+
* @deprecated use `document.documentElement.lang` instead
|
|
587
588
|
*/
|
|
588
589
|
async getCurrentLanguage() {
|
|
589
590
|
var _a;
|
|
@@ -31,7 +31,7 @@ const PostKlpLoginWidget = class {
|
|
|
31
31
|
if (((_b = (_a = store.state.localizedConfig) === null || _a === void 0 ? void 0 : _a.header) === null || _b === void 0 ? void 0 : _b.showJobsLoginWidget) ||
|
|
32
32
|
!((_d = (_c = store.state.localizedConfig) === null || _c === void 0 ? void 0 : _c.header) === null || _d === void 0 ? void 0 : _d.loginWidgetOptions))
|
|
33
33
|
return;
|
|
34
|
-
const { initializeKLPLoginWidget } = await Promise.resolve().then(function () { return require('./klp-widget.controller-
|
|
34
|
+
const { initializeKLPLoginWidget } = await Promise.resolve().then(function () { return require('./klp-widget.controller-7a8a5ddc.js'); });
|
|
35
35
|
let _e = store.state.localizedConfig.header.loginWidgetOptions, { platform } = _e, widgetOptions = __rest(_e, ["platform"]);
|
|
36
36
|
if (this.logoutUrl !== undefined) {
|
|
37
37
|
platform = Object.assign(Object.assign({}, platform), { logoutURL: this.logoutUrl });
|
|
@@ -40,6 +40,36 @@ const PostKlpLoginWidget = class {
|
|
|
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: store.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
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postKlpLoginWidget = require('./post-klp-login-widget-
|
|
5
|
+
const postKlpLoginWidget = require('./post-klp-login-widget-75dfc12f.js');
|
|
6
6
|
require('./index-ecd8c9bb.js');
|
|
7
7
|
require('./store-c3e61d64.js');
|
|
8
8
|
require('./svg-sprite.component-aff81fb2.js');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postInternetHeader = require('./post-internet-header-
|
|
5
|
+
const postInternetHeader = require('./post-internet-header-72edf928.js');
|
|
6
6
|
require('./index-ecd8c9bb.js');
|
|
7
7
|
require('./index-fbcc9ff3.js');
|
|
8
8
|
require('./language.service-15af0e29.js');
|
|
@@ -456,6 +456,7 @@ const vertx = window.vertx || {};
|
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
+
|
|
459
460
|
function audit(message) {
|
|
460
461
|
const auditingEvent = JSON.stringify({
|
|
461
462
|
adr: address,
|
|
@@ -1364,6 +1365,12 @@ const vertx = window.vertx || {};
|
|
|
1364
1365
|
if (!address) {
|
|
1365
1366
|
if (trySubscription()) {
|
|
1366
1367
|
log('Subscribing to get an address');
|
|
1368
|
+
if (globalThis.console && globalThis.console.info) {
|
|
1369
|
+
console.info('[klp-login-widget] subscribe attempt', {
|
|
1370
|
+
hasNctrl: document.cookie.includes(controlCookieName + '='),
|
|
1371
|
+
userAgent: navigator.userAgent,
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1367
1374
|
const startTime = new Date().getTime();
|
|
1368
1375
|
fetch(platformEndPoints.subscribe, {
|
|
1369
1376
|
method: 'GET',
|
|
@@ -1374,8 +1381,25 @@ const vertx = window.vertx || {};
|
|
|
1374
1381
|
.then(message => handleMessage(message))
|
|
1375
1382
|
.catch(error => {
|
|
1376
1383
|
log('Failed to subscribe: ' + error.message);
|
|
1377
|
-
|
|
1378
|
-
|
|
1384
|
+
if (globalThis.console && globalThis.console.warn) {
|
|
1385
|
+
console.warn('[klp-login-widget] subscribe failed', {
|
|
1386
|
+
errorType: error.constructor ? error.constructor.name : typeof error,
|
|
1387
|
+
errorMessage: error.message,
|
|
1388
|
+
isTypeError: error instanceof TypeError,
|
|
1389
|
+
hasNctrl: document.cookie.includes(controlCookieName + '='),
|
|
1390
|
+
userAgent: navigator.userAgent,
|
|
1391
|
+
url: globalThis.location.href,
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
if (error instanceof TypeError) {
|
|
1395
|
+
// Fetch cancelled by browser navigation, not an auth failure.
|
|
1396
|
+
// Do not call logout(): this would delete NCTRL and prevent recovery.
|
|
1397
|
+
log('Subscribe cancelled by navigation: preserving NCTRL, skipping logout.');
|
|
1398
|
+
renderWidget();
|
|
1399
|
+
} else {
|
|
1400
|
+
logout();
|
|
1401
|
+
renderWidget();
|
|
1402
|
+
}
|
|
1379
1403
|
});
|
|
1380
1404
|
logPerformanceMetric('subscribe()', new Date().getTime() - startTime);
|
|
1381
1405
|
} else {
|
|
@@ -245,8 +245,11 @@ export class PostInternetBreadcrumbs {
|
|
|
245
245
|
"required": false,
|
|
246
246
|
"optional": true,
|
|
247
247
|
"docs": {
|
|
248
|
-
"tags": [
|
|
249
|
-
|
|
248
|
+
"tags": [{
|
|
249
|
+
"name": "deprecated",
|
|
250
|
+
"text": "overlays will no longer be provided in the next major release, therefore this method will no longer be needed."
|
|
251
|
+
}],
|
|
252
|
+
"text": "Add custom breadcrumb items to the end of the pre-configured list. Handy if your online service has its own navigation structure."
|
|
250
253
|
},
|
|
251
254
|
"attribute": "custom-items",
|
|
252
255
|
"reflect": false
|
|
@@ -262,7 +265,10 @@ export class PostInternetBreadcrumbs {
|
|
|
262
265
|
"required": false,
|
|
263
266
|
"optional": false,
|
|
264
267
|
"docs": {
|
|
265
|
-
"tags": [
|
|
268
|
+
"tags": [{
|
|
269
|
+
"name": "deprecated",
|
|
270
|
+
"text": "Help and Contact buttons will no longer be provided in the next major release, therefore this prop will no longer be needed."
|
|
271
|
+
}],
|
|
266
272
|
"text": "Hide all buttons."
|
|
267
273
|
},
|
|
268
274
|
"attribute": "hide-buttons",
|
|
@@ -14,6 +14,7 @@ export class PostInternetHeader {
|
|
|
14
14
|
/**
|
|
15
15
|
* Get the currently set language as a two letter string ("de", "fr" "it" or "en")
|
|
16
16
|
* @returns string
|
|
17
|
+
* @deprecated use `document.documentElement.lang` instead
|
|
17
18
|
*/
|
|
18
19
|
async getCurrentLanguage() {
|
|
19
20
|
var _a;
|
|
@@ -349,7 +350,10 @@ export class PostInternetHeader {
|
|
|
349
350
|
"required": false,
|
|
350
351
|
"optional": false,
|
|
351
352
|
"docs": {
|
|
352
|
-
"tags": [
|
|
353
|
+
"tags": [{
|
|
354
|
+
"name": "deprecated",
|
|
355
|
+
"text": "this option will no longer be configurable with the new header in the next major release."
|
|
356
|
+
}],
|
|
353
357
|
"text": "Sticky behaviour of the header."
|
|
354
358
|
},
|
|
355
359
|
"attribute": "stickyness",
|
|
@@ -384,7 +388,10 @@ export class PostInternetHeader {
|
|
|
384
388
|
"required": false,
|
|
385
389
|
"optional": false,
|
|
386
390
|
"docs": {
|
|
387
|
-
"tags": [
|
|
391
|
+
"tags": [{
|
|
392
|
+
"name": "deprecated",
|
|
393
|
+
"text": "use the new configuration API to show or hide the meta navigation links. This option will be removed in the next major release."
|
|
394
|
+
}],
|
|
388
395
|
"text": "Toggle the meta navigation."
|
|
389
396
|
},
|
|
390
397
|
"attribute": "meta",
|
|
@@ -402,7 +409,10 @@ export class PostInternetHeader {
|
|
|
402
409
|
"required": false,
|
|
403
410
|
"optional": false,
|
|
404
411
|
"docs": {
|
|
405
|
-
"tags": [
|
|
412
|
+
"tags": [{
|
|
413
|
+
"name": "deprecated",
|
|
414
|
+
"text": "use the new configuration API to show or hide the login. This option will be removed in the next major release."
|
|
415
|
+
}],
|
|
406
416
|
"text": "Toggle the login link (when logged out) or the user widget (when logged in)."
|
|
407
417
|
},
|
|
408
418
|
"attribute": "login",
|
|
@@ -420,7 +430,10 @@ export class PostInternetHeader {
|
|
|
420
430
|
"required": false,
|
|
421
431
|
"optional": false,
|
|
422
432
|
"docs": {
|
|
423
|
-
"tags": [
|
|
433
|
+
"tags": [{
|
|
434
|
+
"name": "deprecated",
|
|
435
|
+
"text": "use the new configuration API to show or hide the search. This option will be removed in the next major release."
|
|
436
|
+
}],
|
|
424
437
|
"text": "Toggle the search button."
|
|
425
438
|
},
|
|
426
439
|
"attribute": "search",
|
|
@@ -438,7 +451,10 @@ export class PostInternetHeader {
|
|
|
438
451
|
"required": false,
|
|
439
452
|
"optional": false,
|
|
440
453
|
"docs": {
|
|
441
|
-
"tags": [
|
|
454
|
+
"tags": [{
|
|
455
|
+
"name": "deprecated",
|
|
456
|
+
"text": "please implement the skiplinks component. This option will be removed in the next major release."
|
|
457
|
+
}],
|
|
442
458
|
"text": "Toggle skiplinks. They help keyboard users to quickly jump to important sections of the page."
|
|
443
459
|
},
|
|
444
460
|
"attribute": "skiplinks",
|
|
@@ -456,8 +472,11 @@ export class PostInternetHeader {
|
|
|
456
472
|
"required": false,
|
|
457
473
|
"optional": true,
|
|
458
474
|
"docs": {
|
|
459
|
-
"tags": [
|
|
460
|
-
|
|
475
|
+
"tags": [{
|
|
476
|
+
"name": "deprecated",
|
|
477
|
+
"text": "this functionality will no longer be provided in the next major release and was deprecated previously."
|
|
478
|
+
}],
|
|
479
|
+
"text": "Define a proxy URL for the config fetch request."
|
|
461
480
|
},
|
|
462
481
|
"attribute": "config-proxy",
|
|
463
482
|
"reflect": false
|
|
@@ -503,7 +522,10 @@ export class PostInternetHeader {
|
|
|
503
522
|
"required": false,
|
|
504
523
|
"optional": true,
|
|
505
524
|
"docs": {
|
|
506
|
-
"tags": [
|
|
525
|
+
"tags": [{
|
|
526
|
+
"name": "deprecated",
|
|
527
|
+
"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."
|
|
528
|
+
}],
|
|
507
529
|
"text": "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."
|
|
508
530
|
},
|
|
509
531
|
"attribute": "language-switch-overrides",
|
|
@@ -526,7 +548,10 @@ export class PostInternetHeader {
|
|
|
526
548
|
"required": false,
|
|
527
549
|
"optional": true,
|
|
528
550
|
"docs": {
|
|
529
|
-
"tags": [
|
|
551
|
+
"tags": [{
|
|
552
|
+
"name": "deprecated",
|
|
553
|
+
"text": "use the main navigation slot to add custom menu entries. This option will be removed in the next major release."
|
|
554
|
+
}],
|
|
530
555
|
"text": "Customize the header config loaded from the post portal."
|
|
531
556
|
},
|
|
532
557
|
"attribute": "custom-config",
|
|
@@ -543,7 +568,10 @@ export class PostInternetHeader {
|
|
|
543
568
|
"required": false,
|
|
544
569
|
"optional": true,
|
|
545
570
|
"docs": {
|
|
546
|
-
"tags": [
|
|
571
|
+
"tags": [{
|
|
572
|
+
"name": "deprecated",
|
|
573
|
+
"text": "this will no longer be supported in the next major release due to low usage, in favor of a project-specific solution."
|
|
574
|
+
}],
|
|
547
575
|
"text": "The header uses this cookie to set the language. Disables automatic language detection."
|
|
548
576
|
},
|
|
549
577
|
"attribute": "language-cookie-key",
|
|
@@ -560,7 +588,10 @@ export class PostInternetHeader {
|
|
|
560
588
|
"required": false,
|
|
561
589
|
"optional": true,
|
|
562
590
|
"docs": {
|
|
563
|
-
"tags": [
|
|
591
|
+
"tags": [{
|
|
592
|
+
"name": "deprecated",
|
|
593
|
+
"text": "this will no longer be supported in the next major release due to low usage, in favor of a project-specific solution."
|
|
594
|
+
}],
|
|
564
595
|
"text": "The header uses this local storage key to set the language. Disables automatic language selection."
|
|
565
596
|
},
|
|
566
597
|
"attribute": "language-local-storage-key",
|
|
@@ -578,7 +609,10 @@ export class PostInternetHeader {
|
|
|
578
609
|
"required": false,
|
|
579
610
|
"optional": true,
|
|
580
611
|
"docs": {
|
|
581
|
-
"tags": [
|
|
612
|
+
"tags": [{
|
|
613
|
+
"name": "deprecated",
|
|
614
|
+
"text": "use the new configuration API to specify the logout URL. This option will be removed in the next major release."
|
|
615
|
+
}],
|
|
582
616
|
"text": "Overrides the logout-url provided by the portal config."
|
|
583
617
|
},
|
|
584
618
|
"attribute": "logout-url",
|
|
@@ -595,7 +629,10 @@ export class PostInternetHeader {
|
|
|
595
629
|
"required": false,
|
|
596
630
|
"optional": true,
|
|
597
631
|
"docs": {
|
|
598
|
-
"tags": [
|
|
632
|
+
"tags": [{
|
|
633
|
+
"name": "deprecated",
|
|
634
|
+
"text": "use the new configuration API to specify these URLs. This option will be removed in the next major release."
|
|
635
|
+
}],
|
|
599
636
|
"text": "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."
|
|
600
637
|
},
|
|
601
638
|
"attribute": "self-admin-origin",
|
|
@@ -612,7 +649,10 @@ export class PostInternetHeader {
|
|
|
612
649
|
"required": false,
|
|
613
650
|
"optional": true,
|
|
614
651
|
"docs": {
|
|
615
|
-
"tags": [
|
|
652
|
+
"tags": [{
|
|
653
|
+
"name": "deprecated",
|
|
654
|
+
"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."
|
|
655
|
+
}],
|
|
616
656
|
"text": "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."
|
|
617
657
|
},
|
|
618
658
|
"attribute": "active-route",
|
|
@@ -636,7 +676,10 @@ export class PostInternetHeader {
|
|
|
636
676
|
"required": false,
|
|
637
677
|
"optional": true,
|
|
638
678
|
"docs": {
|
|
639
|
-
"tags": [
|
|
679
|
+
"tags": [{
|
|
680
|
+
"name": "deprecatedthe",
|
|
681
|
+
"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."
|
|
682
|
+
}],
|
|
640
683
|
"text": "Online Services only: Add custom links to the special online service navigation entry"
|
|
641
684
|
},
|
|
642
685
|
"attribute": "os-flyout-overrides",
|
|
@@ -706,6 +749,9 @@ export class PostInternetHeader {
|
|
|
706
749
|
"tags": [{
|
|
707
750
|
"name": "returns",
|
|
708
751
|
"text": "string"
|
|
752
|
+
}, {
|
|
753
|
+
"name": "deprecated",
|
|
754
|
+
"text": "use `document.documentElement.lang` instead"
|
|
709
755
|
}]
|
|
710
756
|
}
|
|
711
757
|
}
|