@connectid-tools/idp-selector-react 6.5.2 → 6.7.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/Benefits.js CHANGED
@@ -24,5 +24,5 @@ export const Benefits = ({ full, introTextType }) => {
24
24
  const adjustedFullBenefits = bankDetailsIntroTextTypes.includes(introTextType) ? fullBenefitsBankDetails : fullBenefits;
25
25
  const listItemClasses = `cid-idp-selector-benefit ${theme === 'light' ? 'cid-idp-selector-benefit--light' : ''}`;
26
26
  const benefits = full ? adjustedFullBenefits : defaultBenefits;
27
- return (_jsx("ul", { className: `cid-idp-selector-benefits ${full ? 'cid-idp-selector-benefits--box' : ''} ${theme === 'light' ? 'cid-idp-selector-benefits--light' : ''}`, "data-testid": "benefits", children: benefits.map((benefit) => (_jsxs("li", { className: listItemClasses, "data-testid": "benefit-item", children: [_jsx("svg", { className: "cid-idp-selector-benefit-icon", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.28025 8.71975L14.25 1.75L15.3105 2.8105L7.28025 10.8407L3 6.5605L4.0605 5.5L7.28025 8.71975Z" }) }), benefit] }))) }));
27
+ return (_jsx("ul", { className: `cid-idp-selector-benefits ${full ? 'cid-idp-selector-benefits--box' : ''} ${theme === 'light' ? 'cid-idp-selector-benefits--light' : ''}`, "data-testid": "benefits", children: benefits.map((benefit) => (_jsxs("li", { className: listItemClasses, "data-testid": "benefit-item", children: [_jsx("svg", { className: "cid-idp-selector-benefit-icon", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.28025 8.71975L14.25 1.75L15.3105 2.8105L7.28025 10.8407L3 6.5605L4.0605 5.5L7.28025 8.71975Z" }) }), benefit] }, benefit))) }));
28
28
  };
package/CidButton.js CHANGED
@@ -26,6 +26,7 @@ import { useAnalytics } from './analytics';
26
26
  import './global.css';
27
27
  import { getCurrentUrlOrigin } from './navigator';
28
28
  import { isIntroTextTypeValid, isRequiredClaimsValid } from './validator';
29
+ import detectIncognito from './incognito';
29
30
  export const CidButton = ({ onProceed, claims, requiredClaims, rpLogoUrl, requiredCertifications, label = 'Verify', size = 'regular', type, introTextType, fullProcessCollapsible = false, participantsUri = 'https://data.directory.connectid.com.au/participants', certificationStatus = 'Active', rpDataSharingDescription = 'Your details will be shared with the current website.', enableManualVerification = false, showAllParticipants = false, theme = 'dark', logoLockupStyle = 'light', showInfoContent = false, onError = () => { }, }) => {
30
31
  const { data: participants, error, isLoading, } = useSWR(participantsUri, () => __awaiter(void 0, void 0, void 0, function* () {
31
32
  const response = yield fetch(participantsUri);
@@ -35,6 +36,7 @@ export const CidButton = ({ onProceed, claims, requiredClaims, rpLogoUrl, requir
35
36
  }));
36
37
  useAnalytics();
37
38
  const [showPopup, setShowPopup] = useState(false);
39
+ const [isIncognito, setIsIncognito] = useState();
38
40
  const analyticsData = {
39
41
  claims,
40
42
  rpLogoUrl,
@@ -95,20 +97,33 @@ export const CidButton = ({ onProceed, claims, requiredClaims, rpLogoUrl, requir
95
97
  },
96
98
  };
97
99
  useEffect(() => {
98
- analytics === null || analytics === void 0 ? void 0 : analytics.track('ConnectID Button Displayed', analyticsData);
100
+ const track = () => __awaiter(void 0, void 0, void 0, function* () {
101
+ let incognito;
102
+ try {
103
+ const { isPrivate } = yield detectIncognito();
104
+ incognito = isPrivate;
105
+ setIsIncognito(isPrivate);
106
+ }
107
+ catch (error) {
108
+ setIsIncognito(undefined);
109
+ incognito = undefined;
110
+ }
111
+ analytics === null || analytics === void 0 ? void 0 : analytics.track('ConnectID Button Displayed', Object.assign(Object.assign({}, analyticsData), { incognito }));
112
+ });
113
+ track();
99
114
  }, []);
100
115
  const handleOnProceed = (authorisationServerId, authorisationServerName) => {
101
- analytics === null || analytics === void 0 ? void 0 : analytics.track('IDP Selected', Object.assign(Object.assign({}, analyticsData), { authorisationServerId, idp_name: authorisationServerName }));
116
+ analytics === null || analytics === void 0 ? void 0 : analytics.track('IDP Selected', Object.assign(Object.assign({}, analyticsData), { authorisationServerId, idp_name: authorisationServerName, incognito: isIncognito }));
102
117
  setShowPopup(false);
103
118
  onProceed(authorisationServerId);
104
119
  };
105
120
  const handleButtonClick = () => {
106
121
  setShowPopup(true);
107
- analytics === null || analytics === void 0 ? void 0 : analytics.track('ConnectID Button Clicked', analyticsData);
122
+ analytics === null || analytics === void 0 ? void 0 : analytics.track('ConnectID Button Clicked', Object.assign(Object.assign({}, analyticsData), { incognito: isIncognito }));
108
123
  };
109
124
  const handleClosePopup = () => {
110
125
  setShowPopup(false);
111
- analytics === null || analytics === void 0 ? void 0 : analytics.track('IDP Selector Popup Close Button Clicked', analyticsData);
126
+ analytics === null || analytics === void 0 ? void 0 : analytics.track('IDP Selector Popup Close Button Clicked', Object.assign(Object.assign({}, analyticsData), { incognito: isIncognito }));
112
127
  };
113
128
  if (!isRequiredClaimsValid(claims, requiredClaims)) {
114
129
  const errorMessage = `requiredClaims needs to be a subset of claims. claims: ${claims.join(', ')}; requiredClaims: ${requiredClaims === null || requiredClaims === void 0 ? void 0 : requiredClaims.join(', ')}.`;
package/Popup.css CHANGED
@@ -360,6 +360,7 @@
360
360
  .cid-idp-selector-popup-participants {
361
361
  margin-top: 12px;
362
362
  grid-template-columns: 1fr;
363
+ max-height: 550px;
363
364
  }
364
365
  .cid-idp-selector-popup-participant-greyed-out {
365
366
  margin-bottom: 8px;
package/Popup.js CHANGED
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
11
  import { useEffect, useRef, useState } from 'react';
3
12
  import ReactDOM from 'react-dom';
@@ -12,7 +21,9 @@ import { ParticipantsLoader } from './ParticipantsLoader';
12
21
  import './Popup.css';
13
22
  import { useOverrideShiftTab, useOverrideTab } from './TabHook';
14
23
  import { getDeviceType } from './userAgent';
24
+ import detectIncognito from './incognito';
15
25
  export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, showAllParticipants, certificationStatus, popupTitle, rpDataSharingDescription, enableManualVerification, requiredCertifications, rpLogoUrl, participants, error, isLoading, }) => {
26
+ const [isIncognito, setIsIncognito] = useState();
16
27
  const [showClaims, setShowClaims] = useState(false); // mobile only
17
28
  const popupRef = useRef(null);
18
29
  useAnalytics();
@@ -23,6 +34,16 @@ export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, sh
23
34
  useOverrideShiftTab(closeButtonRef, infoboxLinkRef);
24
35
  useEffect(() => {
25
36
  var _a;
37
+ const detectIncognitoMode = () => __awaiter(void 0, void 0, void 0, function* () {
38
+ try {
39
+ const { isPrivate } = yield detectIncognito();
40
+ setIsIncognito(isPrivate);
41
+ }
42
+ catch (error) {
43
+ setIsIncognito(undefined);
44
+ }
45
+ });
46
+ detectIncognitoMode();
26
47
  (_a = popupRef.current) === null || _a === void 0 ? void 0 : _a.focus();
27
48
  }, []);
28
49
  const claimsOrder = {
@@ -80,13 +101,14 @@ export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, sh
80
101
  activeElement.click();
81
102
  }
82
103
  };
83
- const handleConnectIdLinkClicked = () => {
104
+ const handleConnectIdLinkClicked = () => __awaiter(void 0, void 0, void 0, function* () {
84
105
  analytics === null || analytics === void 0 ? void 0 : analytics.track('Link to External Page Clicked', {
85
106
  source: 'what_is_connectid',
86
107
  link_url: 'https://www.connectid.com.au',
87
108
  rp_sub_brand: getCurrentUrlOrigin(),
109
+ incognito: isIncognito,
88
110
  });
89
- };
111
+ });
90
112
  const renderClaimList = () => {
91
113
  return (_jsx("ul", { id: "cid-idp-selector-popup-claims", className: `cid-idp-selector-popup-claims ${showClaims ? 'cid-idp-selector-popup-claims--visible' : ''}`, "data-testid": "claims", children: sortClaims(claims).map((claim) => (_jsxs("li", { className: "cid-idp-selector-popup-claim", "data-testid": `claim-${claim}`, children: [_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16Z", fill: "#BEEDD2" }), _jsx("path", { d: "M4.81445 8.14121L6.95437 10.2811L11.472 5.76465", stroke: "#262626", strokeWidth: "1.7", strokeLinecap: "round" })] }), claimsDescription[claim]] }, claim))) }));
92
114
  };
@@ -131,7 +153,7 @@ export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, sh
131
153
  const hasManualIdp = enableManualVerification && !!manualAuthorisationServer;
132
154
  return (_jsxs(_Fragment, { children: [filteredAuthorisationServers.length > 0 ? (_jsxs("div", { className: "cid-idp-selector-popup-provider-wrapper", children: [_jsx("h3", { className: "cid-idp-selector-popup-subtitle", children: "Choose a provider" }), _jsx("ul", { className: "cid-idp-selector-popup-participants", "data-testid": "participants", children: Array.from(filteredAuthServerByDevice.entries()).map(([authServer, device]) => {
133
155
  return (_jsx("div", { children: participantTile(authServer.AuthorisationServerId, authServer.CustomerFriendlyName, authServer.CustomerFriendlyLogoUri, device) }, authServer.AuthorisationServerId));
134
- }) })] })) : (_jsx("div", { className: "cid-idp-selector-popup-info-box-error-wrapper", "data-testid": "popup-error-info-box", children: _jsx(NoIdpError, { hasManualIdp: hasManualIdp }) })), enableManualVerification && manualAuthorisationServer && (_jsx(_Fragment, { children: _jsxs("p", { className: "cid-idp-selector-popup-manual", children: [_jsx("span", { className: "cid-idp-selector-popup-manual-title", children: "Can't see a provider that works for you?" }), _jsx("span", { className: "cid-idp-selector-popup-manual-action", tabIndex: 0, onClick: () => onProceed(manualAuthorisationServer.AuthorisationServerId, manualAuthorisationServer.CustomerFriendlyName), "data-testid": "manual-verification-action", role: "link", children: "Confirm your identity with a document" }), _jsx("span", { className: "cid-idp-selector-popup-manual-description", children: "ConnectID does not collect, hold or store your personal information at any time." })] }) }))] }));
156
+ }) })] })) : (_jsx("div", { className: "cid-idp-selector-popup-info-box-error-wrapper", "data-testid": "popup-error-info-box", children: _jsx(NoIdpError, { hasManualIdp: hasManualIdp }) })), enableManualVerification && manualAuthorisationServer && (_jsx(_Fragment, { children: _jsxs("p", { className: "cid-idp-selector-popup-manual", children: [_jsx("span", { className: "cid-idp-selector-popup-manual-title", "data-testid": "manual-verification-text", children: "Or, use a document to verify your identity" }), _jsx("span", { className: "cid-idp-selector-popup-manual-action", tabIndex: 0, onClick: () => onProceed(manualAuthorisationServer.AuthorisationServerId, manualAuthorisationServer.CustomerFriendlyName), "data-testid": "manual-verification-action", role: "link", children: "Verify with a document" }), _jsx("span", { className: "cid-idp-selector-popup-manual-description", children: "ConnectID does not collect, hold or store your personal information at any time." })] }) }))] }));
135
157
  };
136
158
  return ReactDOM.createPortal(_jsxs("div", { className: "cid-idp-selector-popup", tabIndex: 0, ref: popupRef, onKeyDown: handleEnterEsc, children: [_jsxs("div", { className: "cid-idp-selector-popup-logo-container", children: [_jsxs("div", { className: "cid-idp-selector-popup-logos", children: [_jsxs("svg", { role: "img", focusable: "false", className: "cid-idp-selector-popup-logo", viewBox: "0 0 132.37 157.84", "data-testid": "cid-logo", children: [_jsx("title", { children: "ConnectID logo" }), _jsx("path", { d: "M102.22,91.65c0,19.9-16.13,36.03-36.03,36.03s-36.03-16.13-36.03-36.03,16.13-36.03,36.03-36.03c9.95,0,18.96,4.03,25.48,10.55l40.71-40.71c-6.52-6.52-10.55-15.52-10.55-25.46h-30.14c0,13.45,4.02,25.95,10.92,36.39-10.45-6.9-22.96-10.93-36.42-10.93C29.63,25.47,0,55.1,0,91.65s29.63,66.19,66.19,66.19,66.19-29.63,66.19-66.19h-30.16Z" })] }), rpLogoUrl && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "cid-idp-selector-popup-logo-dots", children: [_jsx("div", { className: "cid-idp-selector-popup-logo-dot" }), _jsx("div", { className: "cid-idp-selector-popup-logo-dot" }), _jsx("div", { className: "cid-idp-selector-popup-logo-dot" })] }), _jsx("img", { className: "cid-idp-selector-popup-logo-rp", src: rpLogoUrl, alt: "RP logo", "data-testid": "rp-logo" })] }))] }), _jsxs("button", { "aria-label": "Close popup", "data-testid": "popup-close", className: "cid-idp-selector-popup-close", onClick: onCancel, tabIndex: 0, ref: closeButtonRef, children: [_jsx("span", { className: "cid-idp-selector-popup-close-label", children: "Close" }), _jsx("svg", { clipRule: "evenodd", fillRule: "evenodd", strokeLinejoin: "round", strokeMiterlimit: "2", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "m12 10.93 5.719-5.72c.146-.146.339-.219.531-.219.404 0 .75.324.75.749 0 .193-.073.385-.219.532l-5.72 5.719 5.719 5.719c.147.147.22.339.22.531 0 .427-.349.75-.75.75-.192 0-.385-.073-.531-.219l-5.719-5.719-5.719 5.719c-.146.146-.339.219-.531.219-.401 0-.75-.323-.75-.75 0-.192.073-.384.22-.531l5.719-5.719-5.72-5.719c-.146-.147-.219-.339-.219-.532 0-.425.346-.749.75-.749.192 0 .385.073.531.219z" }) })] })] }), _jsxs("div", { className: "cid-idp-selector-popup-title-description-container", children: [_jsx("h2", { className: "cid-idp-selector-popup-title", children: popupTitle }), _jsx("p", { className: "cid-idp-selector-popup-description", children: rpDataSharingDescription })] }), renderClaims(), renderAuthorisationServers(), _jsx("div", { className: "cid-idp-selector-popup-info-box-wrapper", children: _jsxs(InfoBox, { children: [_jsx("h4", { className: "cid-idp-selector-popup-info-box-title", children: "What is ConnectID?" }), _jsxs("p", { className: "cid-idp-selector-popup-info-box-text", "data-testid": "whats-cid-text", children: ["ConnectID is an Australian-owned digital identity solution which allows you to securely prove who you are. ConnectID does not see or store your personal data. Visit", ' ', _jsx("a", { className: "cid-idp-selector-popup-info-box-link", href: "https://www.connectid.com.au", onClick: handleConnectIdLinkClicked, target: "_blank", tabIndex: 0, "data-testid": "info-box-link", ref: infoboxLinkRef, children: "connectid.com.au" }), ' ', "to find out more."] })] }) })] }), document.querySelector('body'));
137
159
  };
package/README.md CHANGED
@@ -222,6 +222,14 @@ The SVG image below the ConnectID button has either option dark or light mode. B
222
222
 
223
223
  ## 🚀 Release Notes
224
224
 
225
+ ### 6.7.0 (May 5, 2025)
226
+ - Detect incognito.
227
+
228
+ ### 6.6.0 (May 5, 2025)
229
+ - Fix benefits list (missing `key`).
230
+ - Update verify manually copy.
231
+ - Show 8 IDPs on mobile view without needing to scroll.
232
+
225
233
  ### 6.5.2 (Apr 30, 2025)
226
234
  - Fix `introTextType` in README.
227
235
 
package/analytics.js CHANGED
@@ -11,8 +11,8 @@ export const useAnalytics = () => {
11
11
  return;
12
12
  // If the snippet was invoked already show an error.
13
13
  if (analytics.invoked) {
14
- if (window.console && console.error) {
15
- console.error('Segment snippet included twice.');
14
+ if (window.console) {
15
+ console.log('Segment snippet included twice.');
16
16
  }
17
17
  return;
18
18
  }
package/incognito.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ /*!
2
+ *
3
+ * detectIncognito v1.4.1
4
+ *
5
+ * https://github.com/Joe12387/detectIncognito
6
+ *
7
+ * MIT License
8
+ *
9
+ * Copyright (c) 2021 - 2024 Joe Rutkowski <Joe@dreggle.com>
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ * of this software and associated documentation files (the "Software"), to deal
13
+ * in the Software without restriction, including without limitation the rights
14
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ * copies of the Software, and to permit persons to whom the Software is
16
+ * furnished to do so, subject to the following conditions:
17
+ *
18
+ * The above copyright notice and this permission notice shall be included in all
19
+ * copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ * SOFTWARE.
28
+ *
29
+ * Please keep this comment intact in order to properly abide by the MIT License.
30
+ *
31
+ **/
32
+ declare global {
33
+ interface Window {
34
+ detectIncognito: typeof detectIncognito;
35
+ }
36
+ }
37
+ export declare function detectIncognito(): Promise<{
38
+ isPrivate: boolean;
39
+ browserName: string;
40
+ }>;
41
+ export default detectIncognito;
package/incognito.js ADDED
@@ -0,0 +1,239 @@
1
+ /* eslint-disable */
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ export function detectIncognito() {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ return yield new Promise(function (resolve, reject) {
14
+ let browserName = 'Unknown';
15
+ function __callback(isPrivate) {
16
+ resolve({
17
+ isPrivate,
18
+ browserName
19
+ });
20
+ }
21
+ function identifyChromium() {
22
+ const ua = navigator.userAgent;
23
+ if (ua.match(/Chrome/)) {
24
+ if (navigator.brave !== undefined) {
25
+ return 'Brave';
26
+ }
27
+ else if (ua.match(/Edg/)) {
28
+ return 'Edge';
29
+ }
30
+ else if (ua.match(/OPR/)) {
31
+ return 'Opera';
32
+ }
33
+ return 'Chrome';
34
+ }
35
+ else {
36
+ return 'Chromium';
37
+ }
38
+ }
39
+ function assertEvalToString(value) {
40
+ return value === eval.toString().length;
41
+ }
42
+ function feid() {
43
+ let toFixedEngineID = 0;
44
+ let neg = parseInt("-1");
45
+ try {
46
+ neg.toFixed(neg);
47
+ }
48
+ catch (e) {
49
+ toFixedEngineID = e.message.length;
50
+ }
51
+ return toFixedEngineID;
52
+ }
53
+ function isSafari() {
54
+ return feid() === 44;
55
+ }
56
+ function isChrome() {
57
+ return feid() === 51;
58
+ }
59
+ function isFirefox() {
60
+ return feid() === 25;
61
+ }
62
+ function isMSIE() {
63
+ return (navigator.msSaveBlob !== undefined && assertEvalToString(39));
64
+ }
65
+ /**
66
+ * Safari (Safari for iOS & macOS)
67
+ **/
68
+ function newSafariTestByStorageFallback() {
69
+ var _a;
70
+ if (!((_a = navigator.storage) === null || _a === void 0 ? void 0 : _a.estimate)) {
71
+ __callback(false);
72
+ return;
73
+ }
74
+ navigator.storage
75
+ .estimate()
76
+ .then(({ usage, quota }) => {
77
+ // iOS 18.x/macOS Safari 18.x (normal): ~41GB
78
+ // iOS 18.x/macOS Safari 18.x (private): ~1GB
79
+ // If reported quota < 2 GB => likely private
80
+ if (quota && quota < 2000000000) {
81
+ __callback(true);
82
+ }
83
+ else {
84
+ __callback(false);
85
+ }
86
+ })
87
+ .catch(() => {
88
+ __callback(false);
89
+ });
90
+ }
91
+ function newSafariTest() {
92
+ const tmp_name = String(Math.random());
93
+ try {
94
+ const db = window.indexedDB.open(tmp_name, 1);
95
+ db.onupgradeneeded = function (i) {
96
+ var _a, _b;
97
+ const res = (_a = i.target) === null || _a === void 0 ? void 0 : _a.result;
98
+ try {
99
+ res.createObjectStore('test', {
100
+ autoIncrement: true
101
+ }).put(new Blob());
102
+ }
103
+ catch (e) {
104
+ let message = e;
105
+ if (e instanceof Error) {
106
+ message = (_b = e.message) !== null && _b !== void 0 ? _b : e;
107
+ }
108
+ if (typeof message !== 'string') {
109
+ __callback(false);
110
+ return;
111
+ }
112
+ const matchesExpectedError = message.includes('BlobURLs are not yet supported');
113
+ if (matchesExpectedError) {
114
+ __callback(true);
115
+ }
116
+ }
117
+ finally {
118
+ res.close();
119
+ window.indexedDB.deleteDatabase(tmp_name);
120
+ // indexdb works on newer versions of safari so we need to check via storage fallback
121
+ newSafariTestByStorageFallback();
122
+ }
123
+ };
124
+ }
125
+ catch (e) {
126
+ __callback(false);
127
+ }
128
+ }
129
+ function oldSafariTest() {
130
+ const openDB = window.openDatabase;
131
+ const storage = window.localStorage;
132
+ try {
133
+ openDB(null, null, null, null);
134
+ }
135
+ catch (e) {
136
+ __callback(true);
137
+ return;
138
+ }
139
+ try {
140
+ storage.setItem('test', '1');
141
+ storage.removeItem('test');
142
+ }
143
+ catch (e) {
144
+ __callback(true);
145
+ return;
146
+ }
147
+ __callback(false);
148
+ }
149
+ function safariPrivateTest() {
150
+ if (navigator.maxTouchPoints !== undefined) {
151
+ newSafariTest();
152
+ }
153
+ else {
154
+ oldSafariTest();
155
+ }
156
+ }
157
+ /**
158
+ * Chrome
159
+ **/
160
+ function getQuotaLimit() {
161
+ const w = window;
162
+ if (w.performance !== undefined &&
163
+ w.performance.memory !== undefined &&
164
+ w.performance.memory.jsHeapSizeLimit !== undefined) {
165
+ return performance.memory.jsHeapSizeLimit;
166
+ }
167
+ return 1073741824;
168
+ }
169
+ // >= 76
170
+ function storageQuotaChromePrivateTest() {
171
+ navigator.webkitTemporaryStorage.queryUsageAndQuota(function (_, quota) {
172
+ const quotaInMib = Math.round(quota / (1024 * 1024));
173
+ const quotaLimitInMib = Math.round(getQuotaLimit() / (1024 * 1024)) * 2;
174
+ __callback(quotaInMib < quotaLimitInMib);
175
+ }, function (e) {
176
+ reject(new Error('detectIncognito somehow failed to query storage quota: ' +
177
+ e.message));
178
+ });
179
+ }
180
+ // 50 to 75
181
+ function oldChromePrivateTest() {
182
+ const fs = window.webkitRequestFileSystem;
183
+ const success = function () {
184
+ __callback(false);
185
+ };
186
+ const error = function () {
187
+ __callback(true);
188
+ };
189
+ fs(0, 1, success, error);
190
+ }
191
+ function chromePrivateTest() {
192
+ if (self.Promise !== undefined && self.Promise.allSettled !== undefined) {
193
+ storageQuotaChromePrivateTest();
194
+ }
195
+ else {
196
+ oldChromePrivateTest();
197
+ }
198
+ }
199
+ /**
200
+ * Firefox
201
+ **/
202
+ function firefoxPrivateTest() {
203
+ __callback(navigator.serviceWorker === undefined);
204
+ }
205
+ /**
206
+ * MSIE
207
+ **/
208
+ function msiePrivateTest() {
209
+ __callback(window.indexedDB === undefined);
210
+ }
211
+ function main() {
212
+ if (isSafari()) {
213
+ browserName = 'Safari';
214
+ safariPrivateTest();
215
+ }
216
+ else if (isChrome()) {
217
+ browserName = identifyChromium();
218
+ chromePrivateTest();
219
+ }
220
+ else if (isFirefox()) {
221
+ browserName = 'Firefox';
222
+ firefoxPrivateTest();
223
+ }
224
+ else if (isMSIE()) {
225
+ browserName = 'Internet Explorer';
226
+ msiePrivateTest();
227
+ }
228
+ else {
229
+ reject(new Error('detectIncognito cannot determine the browser'));
230
+ }
231
+ }
232
+ main();
233
+ });
234
+ });
235
+ }
236
+ if (typeof window !== 'undefined') {
237
+ window.detectIncognito = detectIncognito;
238
+ }
239
+ export default detectIncognito;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectid-tools/idp-selector-react",
3
- "version": "6.5.2",
3
+ "version": "6.7.0",
4
4
  "description": "React component for IDP Selector.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,19 +25,19 @@
25
25
  },
26
26
  "homepage": "https://github.com/connectid-tools/idp-selector-react",
27
27
  "devDependencies": {
28
- "@babel/preset-typescript": "^7.27.0",
28
+ "@babel/preset-typescript": "^7.27.1",
29
29
  "@types/node": "^22.15.3",
30
30
  "@types/react": "^18.3.20",
31
- "@types/react-dom": "^18.3.6",
31
+ "@types/react-dom": "^18.3.7",
32
32
  "cypress": "^13.17.0",
33
33
  "jest-environment-jsdom": "^29.7.0",
34
34
  "prettier": "^3.5.3",
35
35
  "react": "^18.3.1",
36
36
  "react-dom": "^18.3.1",
37
37
  "replace-in-file": "^8.3.0",
38
- "tsx": "^4.19.3",
38
+ "tsx": "^4.19.4",
39
39
  "typescript": "^5.8.3",
40
- "vite": "^5.4.18"
40
+ "vite": "^5.4.19"
41
41
  },
42
42
  "dependencies": {
43
43
  "react-responsive": "^10.0.1",