@connectid-tools/idp-selector-react 6.6.0 → 6.8.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/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
@@ -153,7 +153,8 @@
153
153
  flex-shrink: 0;
154
154
  }
155
155
  .cid-idp-selector-popup-participants {
156
- margin-top: 24px;
156
+ list-style: none;
157
+ margin: 24px 0 16px 0;
157
158
  display: grid;
158
159
  grid-template-columns: 225px 225px;
159
160
  grid-gap: 16px;
@@ -173,33 +174,11 @@
173
174
  padding: 8px 16px;
174
175
  border: 1px solid #E9E9E9;
175
176
  }
176
- .cid-idp-selector-popup-participant-greyed-out {
177
- display: flex;
178
- align-items: center;
179
- border-radius: 12px;
180
- cursor: pointer;
181
- box-sizing: border-box;
182
- padding: 8px 16px;
183
- border: 1px solid #E9E9E9;
184
- background-color: #F4F4F4;
185
- cursor: default;
186
- margin-bottom: 4px;
187
- }
188
- .cid-idp-selector-popup-participant-greyed-out-text {
189
- color: #5C5C5C;
190
- font-size: 10px;
191
- }
192
177
  .cid-idp-selector-popup-participant-icon {
193
178
  width: 32px;
194
179
  height: 32px;
195
180
  border-radius: 8px;
196
181
  }
197
- .cid-idp-selector-popup-participant-icon-greyed-out {
198
- width: 32px;
199
- height: 32px;
200
- border-radius: 8px;
201
- opacity: 60%
202
- }
203
182
  .cid-idp-selector-popup-participant-description {
204
183
  position: absolute;
205
184
  width: 1px;
@@ -224,16 +203,26 @@
224
203
  text-overflow: ellipsis;
225
204
  width: 90%;
226
205
  }
227
- .cid-idp-selector-popup-participant-name-greyed-out {
228
- font-size: 14px;
206
+ .cid-idp-selector-popup-missing {
207
+ border-radius: 12px;
208
+ background: #F4F4F4;
209
+ padding: 18px;
210
+ }
211
+ .cid-idp-selector-popup-missing-title {
212
+ color: var(--charcoal);
229
213
  font-family: var(--font);
214
+ font-size: 12px;
215
+ font-weight: 600;
216
+ line-height: 120%;
217
+ margin: 0;
218
+ }
219
+ .cid-idp-selector-popup-missing-text {
230
220
  color: var(--charcoal75);
231
- margin-left: 12px;
232
- overflow: hidden;
233
- white-space: nowrap;
234
- text-overflow: ellipsis;
235
- width: 90%;
236
-
221
+ font-family: var(--font);
222
+ font-size: 12px;
223
+ font-weight: 400;
224
+ line-height: 120%;
225
+ margin: 8px 0 0 0;
237
226
  }
238
227
  .cid-idp-selector-popup-manual {
239
228
  font-family: var(--font);
@@ -294,18 +283,6 @@
294
283
  max-width: 466px;
295
284
  }
296
285
 
297
- .cid-greyout-participant-name {
298
- position: absolute;
299
- display: inline-flex;
300
- flex-direction: row;
301
- align-items: center;
302
- }
303
-
304
- .cid-idp-selector-button-info-icon-greyed-out {
305
- margin-right: 2px;
306
- flex-shrink: 0;
307
- }
308
-
309
286
  @media (prefers-reduced-motion: reduce) {
310
287
  .cid-idp-selector-popup-logo-dot {
311
288
  animation: none;
@@ -324,6 +301,7 @@
324
301
  margin: 20px 0;
325
302
  }
326
303
  .cid-idp-selector-popup-participants {
304
+ margin: 16px 0 12px 0;
327
305
  grid-template-columns: 190px 190px;
328
306
  }
329
307
  }
@@ -358,13 +336,9 @@
358
336
  margin: 20px auto 0 auto;
359
337
  }
360
338
  .cid-idp-selector-popup-participants {
361
- margin-top: 12px;
362
339
  grid-template-columns: 1fr;
363
340
  max-height: 550px;
364
341
  }
365
- .cid-idp-selector-popup-participant-greyed-out {
366
- margin-bottom: 8px;
367
- }
368
342
  .cid-idp-selector-popup-participant-name {
369
343
  overflow: inherit;
370
344
  white-space: normal;
@@ -372,9 +346,6 @@
372
346
  width: 100%;
373
347
  font-size: 16px;
374
348
  }
375
- .cid-greyout-participant-name {
376
- margin-top: -6px;
377
- }
378
349
  .cid-idp-selector-popup-close {
379
350
  position: absolute;
380
351
  padding: 8px;
package/Popup.js CHANGED
@@ -1,9 +1,18 @@
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';
4
13
  import { useMediaQuery } from 'react-responsive';
5
14
  import { useAnalytics } from './analytics';
6
- import { filterAuthorisationServers, getManualAuthorisationServer, mapAuthorisationServerToDeviceType, } from './certification';
15
+ import { filterAuthorisationServers, getManualAuthorisationServer } from './certification';
7
16
  import './global.css';
8
17
  import { InfoBox } from './InfoBox';
9
18
  import { getCurrentUrlOrigin } from './navigator';
@@ -11,8 +20,9 @@ import { NoIdpError } from './NoIdpError';
11
20
  import { ParticipantsLoader } from './ParticipantsLoader';
12
21
  import './Popup.css';
13
22
  import { useOverrideShiftTab, useOverrideTab } from './TabHook';
14
- import { getDeviceType } from './userAgent';
23
+ import detectIncognito from './incognito';
15
24
  export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, showAllParticipants, certificationStatus, popupTitle, rpDataSharingDescription, enableManualVerification, requiredCertifications, rpLogoUrl, participants, error, isLoading, }) => {
25
+ const [isIncognito, setIsIncognito] = useState();
16
26
  const [showClaims, setShowClaims] = useState(false); // mobile only
17
27
  const popupRef = useRef(null);
18
28
  useAnalytics();
@@ -23,6 +33,16 @@ export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, sh
23
33
  useOverrideShiftTab(closeButtonRef, infoboxLinkRef);
24
34
  useEffect(() => {
25
35
  var _a;
36
+ const detectIncognitoMode = () => __awaiter(void 0, void 0, void 0, function* () {
37
+ try {
38
+ const { isPrivate } = yield detectIncognito();
39
+ setIsIncognito(isPrivate);
40
+ }
41
+ catch (error) {
42
+ setIsIncognito(undefined);
43
+ }
44
+ });
45
+ detectIncognitoMode();
26
46
  (_a = popupRef.current) === null || _a === void 0 ? void 0 : _a.focus();
27
47
  }, []);
28
48
  const claimsOrder = {
@@ -80,13 +100,14 @@ export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, sh
80
100
  activeElement.click();
81
101
  }
82
102
  };
83
- const handleConnectIdLinkClicked = () => {
103
+ const handleConnectIdLinkClicked = () => __awaiter(void 0, void 0, void 0, function* () {
84
104
  analytics === null || analytics === void 0 ? void 0 : analytics.track('Link to External Page Clicked', {
85
105
  source: 'what_is_connectid',
86
106
  link_url: 'https://www.connectid.com.au',
87
107
  rp_sub_brand: getCurrentUrlOrigin(),
108
+ incognito: isIncognito,
88
109
  });
89
- };
110
+ });
90
111
  const renderClaimList = () => {
91
112
  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
113
  };
@@ -101,14 +122,6 @@ export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, sh
101
122
  }
102
123
  return (_jsxs(_Fragment, { children: [_jsx("div", { className: "cid-idp-selector-popup-title-container", children: renderClaimsTitle() }), renderClaimList()] }));
103
124
  };
104
- const participantTile = (AuthorisationServerId, CustomerFriendlyName, CustomerFriendlyLogoUri, deviceType) => {
105
- if (deviceType === 'desktop') {
106
- return (_jsxs("div", { children: [_jsx("span", { id: `participant-greyed-out-description-${CustomerFriendlyName}`, className: "cid-idp-selector-popup-participant-description", "aria-hidden": "true", children: "available on mobile only" }), _jsxs("li", { "data-testid": "participant-greyed-out", className: "cid-idp-selector-popup-participant-greyed-out", "aria-disabled": "true", "aria-describedby": `participant-greyed-out-description-${CustomerFriendlyName}`, tabIndex: 0, children: [_jsx("img", { className: "cid-idp-selector-popup-participant-icon-greyed-out", src: CustomerFriendlyLogoUri, alt: `${CustomerFriendlyName} logo` }), _jsx("div", { className: "cid-idp-selector-popup-participant-name-greyed-out", title: CustomerFriendlyName, "data-testid": "participant-name", children: CustomerFriendlyName })] }, AuthorisationServerId), _jsxs("div", { className: "cid-greyout-participant-name", children: [_jsxs("svg", { className: "cid-idp-selector-button-info-icon-greyed-out", width: "8", height: "8", viewBox: "0 0 13 13", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M6.53509 12.3572C9.59207 12.3572 12.0702 9.81483 12.0702 6.67859C12.0702 3.54239 9.59207 1 6.53509 1C3.47814 1 1 3.54239 1 6.67859C1 9.81483 3.47814 12.3572 6.53509 12.3572Z", stroke: "#262626", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M5.25781 9.29883H7.81247", stroke: "#262626", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M6.53515 4.49472C6.7703 4.49472 6.96093 4.29915 6.96093 4.05791C6.96093 3.81666 6.7703 3.62109 6.53515 3.62109C6.3 3.62109 6.10938 3.81666 6.10938 4.05791C6.10938 4.29915 6.3 4.49472 6.53515 4.49472Z", fill: "#262626", stroke: "#262626", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M6.53515 9.29989V6.24219H5.68359", stroke: "#262626", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("div", { "data-testid": "cid-greyout-participant-name-mobile-only", className: "cid-idp-selector-popup-participant-greyed-out-text", "aria-describedby": `participant-greyed-out-description-${CustomerFriendlyName}`, children: "Available on mobile only" })] })] }));
107
- }
108
- else {
109
- return (_jsxs("li", { "data-testid": "participant", className: "cid-idp-selector-popup-participant", tabIndex: 0, onClick: () => onProceed(AuthorisationServerId, CustomerFriendlyName), children: [_jsx("img", { className: "cid-idp-selector-popup-participant-icon", src: CustomerFriendlyLogoUri, alt: `${CustomerFriendlyName} logo` }), _jsx("div", { className: "cid-idp-selector-popup-participant-name", title: CustomerFriendlyName, "data-testid": "participant-name", children: CustomerFriendlyName })] }, AuthorisationServerId));
110
- }
111
- };
112
125
  const renderAuthorisationServers = () => {
113
126
  if (isLoading) {
114
127
  return (_jsxs("div", { className: "cid-idp-selector-popup-provider-wrapper", children: [_jsx("h3", { className: "cid-idp-selector-popup-subtitle", children: "Choose a provider" }), _jsx(ParticipantsLoader, {})] }));
@@ -120,18 +133,19 @@ export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, sh
120
133
  return (_jsx("div", { className: "cid-idp-selector-popup-info-box-wrapper-warn", children: _jsx(NoIdpError, { dataTestId: "participant-error", hasManualIdp: false }) }));
121
134
  }
122
135
  const authorisationServers = participants
123
- .map((participant) => participant.AuthorisationServers)
124
- .flat()
136
+ .flatMap((participant) => participant.AuthorisationServers)
125
137
  .sort((authServer1, authServer2) => authServer1.CustomerFriendlyName.localeCompare(authServer2.CustomerFriendlyName));
126
138
  const manualAuthorisationServer = getManualAuthorisationServer(authorisationServers, showAllParticipants);
127
139
  const authorisationServersWithoutManual = authorisationServers.filter(({ AuthorisationServerId }) => AuthorisationServerId !== (manualAuthorisationServer === null || manualAuthorisationServer === void 0 ? void 0 : manualAuthorisationServer.AuthorisationServerId));
128
140
  const filterByClaims = requiredClaims || claims;
129
141
  const filteredAuthorisationServers = filterAuthorisationServers(authorisationServersWithoutManual, showAllParticipants, certificationStatus, filterByClaims, requiredCertifications);
130
- const filteredAuthServerByDevice = mapAuthorisationServerToDeviceType(filteredAuthorisationServers, getDeviceType());
142
+ // Getting all auth servers that have certifications with profile type 'Redirect' and profile variant 'FAPI2 Adv. OP w/Private Key, PAR'
143
+ const authorisationServerWithProfileRedirectFapi2 = authorisationServersWithoutManual.filter(({ AuthorisationServerCertifications }) => {
144
+ return AuthorisationServerCertifications.find(({ ProfileType, ProfileVariant }) => ProfileType === 'Redirect' && ProfileVariant === 'FAPI2 Adv. OP w/Private Key, PAR');
145
+ });
146
+ const missingAuthorisationServerWithProfileRedirectFapi2 = authorisationServerWithProfileRedirectFapi2.length !== filteredAuthorisationServers.length;
131
147
  const hasManualIdp = enableManualVerification && !!manualAuthorisationServer;
132
- 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
- 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", "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." })] }) }))] }));
148
+ 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: filteredAuthorisationServers.map(({ AuthorisationServerId, CustomerFriendlyName, CustomerFriendlyLogoUri }) => (_jsxs("li", { "data-testid": "participant", className: "cid-idp-selector-popup-participant", tabIndex: 0, onClick: () => onProceed(AuthorisationServerId, CustomerFriendlyName), children: [_jsx("img", { className: "cid-idp-selector-popup-participant-icon", src: CustomerFriendlyLogoUri, alt: `${CustomerFriendlyName} logo` }), _jsx("div", { className: "cid-idp-selector-popup-participant-name", title: CustomerFriendlyName, "data-testid": "participant-name", children: CustomerFriendlyName })] }, AuthorisationServerId))) }), missingAuthorisationServerWithProfileRedirectFapi2 && (_jsxs("div", { className: "cid-idp-selector-popup-missing", "data-testid": "missing-auth-server", children: [_jsx("p", { className: "cid-idp-selector-popup-missing-title", children: "Can't find your provider?" }), _jsx("p", { className: "cid-idp-selector-popup-missing-text", children: "Not all of our identity providers are available for this verification." })] }))] })) : (_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
149
  };
136
150
  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
151
  };
package/README.md CHANGED
@@ -222,6 +222,12 @@ 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.8.0 (May 7, 2025)
226
+ - Show message in the IDP list when any IDP with `ProfileType=Redirect` and `ProfileVariant=FAPI2 Adv. OP w/Private Key, PAR` is not being displayed.
227
+
228
+ ### 6.7.0 (May 5, 2025)
229
+ - Detect incognito.
230
+
225
231
  ### 6.6.0 (May 5, 2025)
226
232
  - Fix benefits list (missing `key`).
227
233
  - Update verify manually copy.
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
  }
@@ -3,6 +3,6 @@ export declare const filterAuthorisationServers: (authorisationServers: Authoris
3
3
  export declare const getManualAuthorisationServer: (authorisationServers: AuthorisationServer[], showAllParticipants: boolean) => AuthorisationServer | undefined;
4
4
  export declare const removeExpiredOrNotStartedCertifications: (authorisationServers: AuthorisationServer[]) => AuthorisationServer[];
5
5
  export declare const filterAuthorisationServerByClaims: (authorisationServers: AuthorisationServer[], claims: Claim[]) => AuthorisationServer[];
6
- export declare const mapAuthorisationServerToDeviceType: (authorisationServers: AuthorisationServer[], deviceType: Device) => Map<AuthorisationServer, Device>;
7
6
  export declare const filterAuthorisationServerByCertification: (authorisationServers: AuthorisationServer[], status: CertificationStatus, requiredCertifications?: RequiredCertification[]) => AuthorisationServer[];
7
+ export declare const filterAuthorisationServerByDevice: (authorisationServers: AuthorisationServer[], deviceType: Device) => AuthorisationServer[];
8
8
  export declare const hasStarted: (startDateStr: string) => boolean;
package/certification.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { getDeviceType } from './userAgent';
1
2
  const requiredCertificationsMap = {
2
3
  'TDIF.IDP': { type: 'TDIF Accreditation', variant: 'Identity Provider' },
3
4
  'Redirect.FAPI2': { type: 'Redirect', variant: 'FAPI2 Adv. OP w/Private Key, PAR' },
@@ -6,7 +7,9 @@ export const filterAuthorisationServers = (authorisationServers, showAllParticip
6
7
  if (showAllParticipants)
7
8
  return authorisationServers;
8
9
  const authorisationServersWithValidCertifications = removeExpiredOrNotStartedCertifications(authorisationServers);
9
- const filteredAuthorisationServersByClaims = filterAuthorisationServerByClaims(authorisationServersWithValidCertifications, claims);
10
+ const device = getDeviceType();
11
+ const filteredAuthorisationServersByDevice = filterAuthorisationServerByDevice(authorisationServersWithValidCertifications, device);
12
+ const filteredAuthorisationServersByClaims = filterAuthorisationServerByClaims(filteredAuthorisationServersByDevice, claims);
10
13
  const filteredAuthorisationServers = filterAuthorisationServerByCertification(filteredAuthorisationServersByClaims, certificationStatus, requiredCertifications);
11
14
  return filteredAuthorisationServers;
12
15
  };
@@ -37,20 +40,6 @@ export const filterAuthorisationServerByClaims = (authorisationServers, claims)
37
40
  return profileVariants.every((profileVariant) => authorisationServerProfileVariants.includes(profileVariant));
38
41
  });
39
42
  };
40
- export const mapAuthorisationServerToDeviceType = (authorisationServers, deviceType) => {
41
- const authServerMap = new Map();
42
- if (deviceType === 'mobile') {
43
- authorisationServers.forEach((authorisationServer) => {
44
- authServerMap.set(authorisationServer, 'mobile');
45
- });
46
- return authServerMap;
47
- }
48
- authorisationServers.map((authorisationServer) => {
49
- const channelCertifications = authorisationServer.AuthorisationServerCertifications.filter((cert) => cert.ProfileType === 'Channel');
50
- authServerMap.set(authorisationServer, channelCertifications.length === 1 && channelCertifications[0].ProfileVariant === 'app' ? 'desktop' : 'mobile');
51
- });
52
- return authServerMap;
53
- };
54
43
  export const filterAuthorisationServerByCertification = (authorisationServers, status, requiredCertifications) => {
55
44
  const filteredByStatus = filterByStatus(authorisationServers, status);
56
45
  const filteredByStatusAndRequiredCertifications = filterByRequiredCertifications(filteredByStatus, requiredCertifications);
@@ -81,6 +70,18 @@ const filterByRequiredCertifications = (authorisationServers, requiredCertificat
81
70
  return requiredCertificationsFound === requiredCertifications.length;
82
71
  });
83
72
  };
73
+ // mobile return all authorisation servers
74
+ // tablet and desktop return all authorisation servers but those ones with only one certification and that certification is app
75
+ export const filterAuthorisationServerByDevice = (authorisationServers, deviceType) => {
76
+ if (deviceType === 'mobile')
77
+ return authorisationServers;
78
+ const onlyAppAuthorisationServers = authorisationServers.filter((authorisationServer) => {
79
+ const channelCertifications = authorisationServer.AuthorisationServerCertifications.filter((cert) => cert.ProfileType === 'Channel');
80
+ return channelCertifications.length === 1 && channelCertifications[0].ProfileVariant === 'app';
81
+ });
82
+ const onlyAppAuthorisationServersIds = onlyAppAuthorisationServers.map((authorisationServer) => authorisationServer.AuthorisationServerId);
83
+ return authorisationServers.filter((authorisationServer) => !onlyAppAuthorisationServersIds.includes(authorisationServer.AuthorisationServerId));
84
+ };
84
85
  const isExpired = (expiryDateStr) => {
85
86
  const expiryDate = parseCertificationDate(expiryDateStr);
86
87
  expiryDate.setHours(23);
@@ -1,6 +1,6 @@
1
1
  import assert from 'node:assert';
2
2
  import { describe, it } from 'node:test';
3
- import { filterAuthorisationServerByClaims, filterAuthorisationServers, getManualAuthorisationServer, mapAuthorisationServerToDeviceType, removeExpiredOrNotStartedCertifications, } from './certification';
3
+ import { filterAuthorisationServerByClaims, filterAuthorisationServerByDevice, filterAuthorisationServers, getManualAuthorisationServer, removeExpiredOrNotStartedCertifications, } from './certification';
4
4
  describe('filterAuthorisationServers', () => {
5
5
  it('should return all authorisation servers if showAllParticipants is true regardless of certification status, required certifications and claims', () => {
6
6
  const authorisationServers = [
@@ -306,82 +306,93 @@ describe('removeExpiredCertifications', () => {
306
306
  });
307
307
  });
308
308
  describe('filterAuthorisationServerByDevice', () => {
309
- const authorisationServers = [
310
- {
311
- AuthorisationServerId: '71fe3927-f596-4192-ab9a-f6644cdb9b2b',
312
- CustomerFriendlyLogoUri: 'https://static.sandbox.connectid.com.au/BankA.svg',
313
- CustomerFriendlyName: 'Mock Bank A',
314
- AuthorisationServerCertifications: [
315
- {
316
- CertificationStartDate: '10/04/1900',
317
- CertificationExpirationDate: '10/04/2024',
318
- Status: 'Certified',
319
- ProfileVariant: 'web',
320
- ProfileType: 'Channel',
321
- },
322
- ],
323
- },
324
- {
325
- AuthorisationServerId: '71fe3927-f596-4192-ab9a-f6644cdb9b2x',
326
- CustomerFriendlyLogoUri: 'https://static.sandbox.connectid.com.au/BankA.svg',
327
- CustomerFriendlyName: 'Mock Bank B',
328
- AuthorisationServerCertifications: [
329
- {
330
- CertificationStartDate: '10/04/1900',
331
- CertificationExpirationDate: '10/04/2024',
332
- Status: 'Certified',
333
- ProfileVariant: 'web',
334
- ProfileType: 'Channel',
335
- },
336
- ],
337
- },
338
- {
339
- AuthorisationServerId: 'fa8573a1-953a-4085-b5f7-070a42a4d5a9',
340
- CustomerFriendlyLogoUri: 'https://static.sandbox.connectid.com.au/BankC.svg',
341
- CustomerFriendlyName: 'Mock Bank C',
342
- AuthorisationServerCertifications: [
343
- {
344
- CertificationStartDate: '10/04/1900',
345
- CertificationExpirationDate: '10/04/2024',
346
- Status: 'Certified',
347
- ProfileVariant: 'app',
348
- ProfileType: 'Channel',
349
- },
350
- ],
351
- },
352
- {
353
- AuthorisationServerId: 'fa8573a1-953a-4085-b5f7-070a42a4d5a1',
354
- CustomerFriendlyLogoUri: 'https://static.sandbox.connectid.com.au/BankC.svg',
355
- CustomerFriendlyName: 'Mock Bank D',
356
- AuthorisationServerCertifications: [],
357
- },
358
- ];
359
- it('should return all auth servers when device is mobile', () => {
360
- const authServers = mapAuthorisationServerToDeviceType(authorisationServers, 'mobile');
361
- const values = Array.from(authServers.values());
362
- assert.deepStrictEqual(values.every((value) => value === 'mobile'), true);
363
- });
364
- it('should not return auth servers with only app cert when device is desktop', () => {
365
- const authServers = mapAuthorisationServerToDeviceType(authorisationServers, 'desktop');
366
- const filteredAuthServers = Array.from(authServers)
367
- .filter(([_, device]) => device === 'mobile')
368
- .map(([key, _]) => key);
369
- assert.deepStrictEqual(filteredAuthServers, [
370
- authorisationServers[0],
371
- authorisationServers[1],
372
- authorisationServers[3],
373
- ]);
309
+ it('should return all authorisation servers for mobile', () => {
310
+ const authorisationServers = [
311
+ {
312
+ AuthorisationServerId: '1',
313
+ CustomerFriendlyLogoUri: 'https://static.sandbox.connectid.com.au/BankA.svg',
314
+ CustomerFriendlyName: 'Mock Bank A',
315
+ AuthorisationServerCertifications: [
316
+ {
317
+ ProfileType: 'Channel',
318
+ ProfileVariant: 'app',
319
+ CertificationExpirationDate: '10/04/2099',
320
+ Status: 'Certified',
321
+ CertificationStartDate: '10/04/1900',
322
+ },
323
+ ],
324
+ },
325
+ {
326
+ AuthorisationServerId: '2',
327
+ CustomerFriendlyLogoUri: 'https://static.sandbox.connectid.com.au/BankA.svg',
328
+ CustomerFriendlyName: 'Mock Bank B',
329
+ AuthorisationServerCertifications: [
330
+ {
331
+ ProfileType: 'Channel',
332
+ ProfileVariant: 'web',
333
+ CertificationExpirationDate: '10/04/2099',
334
+ Status: 'Certified',
335
+ CertificationStartDate: '10/04/1900',
336
+ },
337
+ ],
338
+ },
339
+ ];
340
+ assert.deepStrictEqual(filterAuthorisationServerByDevice(authorisationServers, 'mobile'), authorisationServers);
374
341
  });
375
- it('should not return auth servers with only app cert when device is tablet', () => {
376
- const authServers = mapAuthorisationServerToDeviceType(authorisationServers, 'tablet');
377
- console.log(authServers);
378
- const filteredAuthServers = Array.from(authServers)
379
- .filter(([_, device]) => device === 'mobile')
380
- .map(([key, _]) => key);
381
- assert.deepStrictEqual(filteredAuthServers, [
382
- authorisationServers[0],
383
- authorisationServers[1],
384
- authorisationServers[3],
385
- ]);
342
+ it('should return all authorisation servers except those with only app certification when desktop', () => {
343
+ const authorisationServers = [
344
+ {
345
+ AuthorisationServerId: '1',
346
+ CustomerFriendlyLogoUri: 'https://static.sandbox.connectid.com.au/BankA.svg',
347
+ CustomerFriendlyName: 'Mock Bank A',
348
+ // has only app certification (removed)
349
+ AuthorisationServerCertifications: [
350
+ {
351
+ ProfileType: 'Channel',
352
+ ProfileVariant: 'app',
353
+ CertificationExpirationDate: '10/04/2099',
354
+ Status: 'Certified',
355
+ CertificationStartDate: '10/04/1900',
356
+ },
357
+ ],
358
+ },
359
+ {
360
+ AuthorisationServerId: '2',
361
+ CustomerFriendlyLogoUri: 'https://static.sandbox.connectid.com.au/BankA.svg',
362
+ CustomerFriendlyName: 'Mock Bank B',
363
+ AuthorisationServerCertifications: [
364
+ {
365
+ ProfileType: 'Channel',
366
+ ProfileVariant: 'web',
367
+ CertificationExpirationDate: '10/04/2099',
368
+ Status: 'Certified',
369
+ CertificationStartDate: '10/04/1900',
370
+ },
371
+ ],
372
+ },
373
+ {
374
+ AuthorisationServerId: '3',
375
+ CustomerFriendlyLogoUri: 'https://static.sandbox.connectid.com.au/BankA.svg',
376
+ CustomerFriendlyName: 'Mock Bank C',
377
+ // has web and app certifications (okay)
378
+ AuthorisationServerCertifications: [
379
+ {
380
+ ProfileType: 'Channel',
381
+ ProfileVariant: 'app',
382
+ CertificationExpirationDate: '10/04/2099',
383
+ Status: 'Certified',
384
+ CertificationStartDate: '10/04/1900',
385
+ },
386
+ {
387
+ ProfileType: 'Channel',
388
+ ProfileVariant: 'web',
389
+ CertificationExpirationDate: '10/04/2099',
390
+ Status: 'Certified',
391
+ CertificationStartDate: '10/04/1900',
392
+ },
393
+ ],
394
+ },
395
+ ];
396
+ assert.deepStrictEqual(filterAuthorisationServerByDevice(authorisationServers, 'desktop'), [authorisationServers[1], authorisationServers[2]]);
386
397
  });
387
398
  });
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.6.0",
3
+ "version": "6.8.0",
4
4
  "description": "React component for IDP Selector.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  "homepage": "https://github.com/connectid-tools/idp-selector-react",
27
27
  "devDependencies": {
28
28
  "@babel/preset-typescript": "^7.27.1",
29
- "@types/node": "^22.15.3",
30
- "@types/react": "^18.3.20",
29
+ "@types/node": "^22.15.14",
30
+ "@types/react": "^18.3.21",
31
31
  "@types/react-dom": "^18.3.7",
32
32
  "cypress": "^13.17.0",
33
33
  "jest-environment-jsdom": "^29.7.0",