@connectid-tools/idp-selector-react 6.10.0-alpha.3 → 6.10.0-alpha.5
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.d.ts +2 -1
- package/CidButton.js +5 -5
- package/CidButtonHowItWorks.js +0 -2
- package/LearnMore.js +0 -2
- package/Popup.js +0 -2
- package/README.md +6 -0
- package/analytics.d.ts +1 -1
- package/analytics.js +1 -1
- package/compatibility.d.ts +1 -1
- package/compatibility.js +6 -8
- package/compatibility.test.js +9 -18
- package/package.json +3 -3
- package/types.d.ts +3 -3
- package/userAgent.d.ts +0 -2
- package/userAgent.js +0 -2
package/CidButton.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './CidButton.css';
|
|
2
2
|
import './global.css';
|
|
3
|
-
import { CertificationStatus, CidButtonLabel, CidButtonSize, CidButtonTheme, CidButtonType, Claim, CompatibilityWarnings, IntroTextType, LogoMode, RequiredCertification } from './types';
|
|
3
|
+
import { Browser, CertificationStatus, CidButtonLabel, CidButtonSize, CidButtonTheme, CidButtonType, Claim, CompatibilityWarnings, IntroTextType, LogoMode, RequiredCertification } from './types';
|
|
4
4
|
type CidButtonProps = {
|
|
5
5
|
onProceed: (authorisationServerId: string, compatibilityWarnings: CompatibilityWarnings) => void;
|
|
6
6
|
claims: Claim[];
|
|
@@ -27,6 +27,7 @@ type CidButtonProps = {
|
|
|
27
27
|
forceIos?: boolean;
|
|
28
28
|
forceAndroid?: boolean;
|
|
29
29
|
forceIncognito?: boolean;
|
|
30
|
+
forceBrowser?: Browser;
|
|
30
31
|
};
|
|
31
32
|
export declare const CidButton: React.FC<CidButtonProps>;
|
|
32
33
|
export {};
|
package/CidButton.js
CHANGED
|
@@ -22,18 +22,20 @@ import { Overlay } from './Overlay';
|
|
|
22
22
|
import { Popup } from './Popup';
|
|
23
23
|
import { Process } from './Process';
|
|
24
24
|
import { ThemeContext } from './ThemeContext';
|
|
25
|
-
import {
|
|
25
|
+
import { initialiseAnalytics } from './analytics';
|
|
26
26
|
import './global.css';
|
|
27
27
|
import { getCurrentUrlOrigin } from './navigator';
|
|
28
28
|
import { isIntroTextTypeValid, isRequiredClaimsValid } from './validator';
|
|
29
29
|
import detectIncognito from './incognito';
|
|
30
|
-
import { getDeviceType, isAndroid,
|
|
30
|
+
import { getBrowserName, getDeviceType, isAndroid, isIos } from './userAgent';
|
|
31
31
|
import { hasCertification } from './certification';
|
|
32
32
|
import { getCompatibility } from './compatibility';
|
|
33
|
+
initialiseAnalytics();
|
|
33
34
|
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 = () => { }, showCompatibilityWarnings = false, supportIncognito = false, forceMobile = false, // only for testing purposes
|
|
34
35
|
forceIos = false, // only for testing purposes
|
|
35
36
|
forceAndroid = false, // only for testing purposes
|
|
36
37
|
forceIncognito = false, // only for testing purposes
|
|
38
|
+
forceBrowser = undefined, // only for testing purposes
|
|
37
39
|
}) => {
|
|
38
40
|
const { data: participants, error, isLoading, } = useSWR(participantsUri, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
41
|
const response = yield fetch(participantsUri);
|
|
@@ -41,7 +43,6 @@ forceIncognito = false, // only for testing purposes
|
|
|
41
43
|
throw new Error(response.statusText);
|
|
42
44
|
return response.json();
|
|
43
45
|
}));
|
|
44
|
-
useAnalytics();
|
|
45
46
|
const [showPopup, setShowPopup] = useState(false);
|
|
46
47
|
const [isIncognito, setIsIncognito] = useState();
|
|
47
48
|
const analyticsData = {
|
|
@@ -137,8 +138,7 @@ forceIncognito = false, // only for testing purposes
|
|
|
137
138
|
isIncognito: forceIncognito || !!isIncognito,
|
|
138
139
|
isAndroid: forceAndroid || isAndroid(),
|
|
139
140
|
isIos: forceIos || isIos(),
|
|
140
|
-
|
|
141
|
-
isChromeBrowser: isChromeBrowser(),
|
|
141
|
+
browser: forceBrowser || getBrowserName(),
|
|
142
142
|
});
|
|
143
143
|
if (showCompatibilityWarnings && compatibility.mightFail) {
|
|
144
144
|
const confirmText = getCompatibilityConfirmText(compatibility);
|
package/CidButtonHowItWorks.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useAnalytics } from './analytics';
|
|
3
2
|
import { getCurrentUrlOrigin } from './navigator';
|
|
4
3
|
import './CidButtonHowItWorks.css';
|
|
5
4
|
import { ThemeContext } from './ThemeContext';
|
|
6
5
|
import { useContext } from 'react';
|
|
7
6
|
export const CidButtonHowItWorks = () => {
|
|
8
|
-
useAnalytics();
|
|
9
7
|
const theme = useContext(ThemeContext);
|
|
10
8
|
const handleClick = () => {
|
|
11
9
|
if (!analytics)
|
package/LearnMore.js
CHANGED
|
@@ -2,10 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import './LearnMore.css';
|
|
4
4
|
import { ThemeContext } from './ThemeContext';
|
|
5
|
-
import { useAnalytics } from './analytics';
|
|
6
5
|
import { getCurrentUrlOrigin } from './navigator';
|
|
7
6
|
export const LearnMore = () => {
|
|
8
|
-
useAnalytics();
|
|
9
7
|
const theme = useContext(ThemeContext);
|
|
10
8
|
const handleClick = () => {
|
|
11
9
|
if (!analytics)
|
package/Popup.js
CHANGED
|
@@ -11,7 +11,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
11
11
|
import { useEffect, useRef, useState } from 'react';
|
|
12
12
|
import ReactDOM from 'react-dom';
|
|
13
13
|
import { useMediaQuery } from 'react-responsive';
|
|
14
|
-
import { useAnalytics } from './analytics';
|
|
15
14
|
import { filterAuthorisationServers, getManualAuthorisationServer } from './certification';
|
|
16
15
|
import './global.css';
|
|
17
16
|
import { InfoBox } from './InfoBox';
|
|
@@ -25,7 +24,6 @@ export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, sh
|
|
|
25
24
|
const [isIncognito, setIsIncognito] = useState();
|
|
26
25
|
const [showClaims, setShowClaims] = useState(false); // mobile only
|
|
27
26
|
const popupRef = useRef(null);
|
|
28
|
-
useAnalytics();
|
|
29
27
|
const isMobile = useMediaQuery({ query: '(max-width: 482px)' });
|
|
30
28
|
const infoboxLinkRef = useRef(null);
|
|
31
29
|
const closeButtonRef = useRef(null);
|
package/README.md
CHANGED
|
@@ -259,6 +259,12 @@ The SVG image below the ConnectID button has either option dark or light mode. B
|
|
|
259
259
|
|
|
260
260
|
## 🚀 Release Notes
|
|
261
261
|
|
|
262
|
+
### 6.10.0-alpha.5 (Jun 25, 2025)
|
|
263
|
+
- Fix analytics double loading.
|
|
264
|
+
|
|
265
|
+
### 6.10.0-alpha.4 (Jun 20, 2025)
|
|
266
|
+
- Add test support for Samsung and Chrome browsers.
|
|
267
|
+
|
|
262
268
|
### 6.10.0-alpha.3 (Jun 20, 2025)
|
|
263
269
|
- Add `supportIncognito` option.
|
|
264
270
|
|
package/analytics.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const initialiseAnalytics: () => void;
|
package/analytics.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const PROD_WRITE_KEY = 'LrD9CEGUEy1O3s73nGbaGcyTqELujozJ';
|
|
2
2
|
const DEV_WRITE_KEY = 'PWlESErGso9uTimwmGB7SsnxCpKF8pRl';
|
|
3
3
|
const WRITE_KEY = 'production' === 'production' ? PROD_WRITE_KEY : DEV_WRITE_KEY;
|
|
4
|
-
export const
|
|
4
|
+
export const initialiseAnalytics = () => {
|
|
5
5
|
// copied from https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
// Create a queue, but don't obliterate an existing one!
|
package/compatibility.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CompatibilityEnvironment, CompatibilityWarnings } from './types';
|
|
2
2
|
export declare const getCompatibility: (env: CompatibilityEnvironment) => CompatibilityWarnings;
|
|
3
|
-
export declare const getMightFail: (env: Pick<CompatibilityEnvironment, "supportIncognito" | "idpHasAppCertification" | "isMobile" | "isIncognito" | "isAndroid" | "isIos" | "
|
|
3
|
+
export declare const getMightFail: (env: Pick<CompatibilityEnvironment, "supportIncognito" | "idpHasAppCertification" | "isMobile" | "isIncognito" | "isAndroid" | "isIos" | "browser">) => boolean;
|
package/compatibility.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { getBrowserName } from './userAgent';
|
|
2
1
|
export const getCompatibility = (env) => {
|
|
3
|
-
const { supportIncognito, idpHasAppCertification, isAndroid,
|
|
2
|
+
const { supportIncognito, idpHasAppCertification, isAndroid, isIncognito, isMobile, isIos, browser } = env;
|
|
4
3
|
const mightFail = getMightFail({
|
|
5
4
|
supportIncognito,
|
|
6
5
|
idpHasAppCertification,
|
|
@@ -8,26 +7,25 @@ export const getCompatibility = (env) => {
|
|
|
8
7
|
isIncognito,
|
|
9
8
|
isAndroid,
|
|
10
9
|
isIos,
|
|
11
|
-
|
|
12
|
-
isChromeBrowser,
|
|
10
|
+
browser
|
|
13
11
|
});
|
|
14
12
|
return {
|
|
15
13
|
isMobile,
|
|
16
14
|
isIncognito,
|
|
17
15
|
mobileOs: isAndroid ? 'android' : isIos ? 'ios' : 'other',
|
|
18
|
-
browser
|
|
16
|
+
browser,
|
|
19
17
|
mightFail,
|
|
20
18
|
};
|
|
21
19
|
};
|
|
22
20
|
export const getMightFail = (env) => {
|
|
23
|
-
const { supportIncognito, idpHasAppCertification, isMobile, isIncognito, isAndroid,
|
|
21
|
+
const { supportIncognito, idpHasAppCertification, isMobile, isIncognito, isAndroid, isIos, browser } = env;
|
|
24
22
|
if (!idpHasAppCertification || !isMobile) {
|
|
25
23
|
return false;
|
|
26
24
|
}
|
|
27
|
-
if (!supportIncognito && isIncognito && isAndroid &&
|
|
25
|
+
if (!supportIncognito && isIncognito && isAndroid && browser === 'chrome') {
|
|
28
26
|
return true;
|
|
29
27
|
}
|
|
30
|
-
if (isAndroid &&
|
|
28
|
+
if (isAndroid && browser === 'samsung') {
|
|
31
29
|
return true;
|
|
32
30
|
}
|
|
33
31
|
if (!supportIncognito && isIncognito && isIos) {
|
package/compatibility.test.js
CHANGED
|
@@ -10,8 +10,7 @@ describe('getCompatibility', () => {
|
|
|
10
10
|
isIncognito: false,
|
|
11
11
|
isAndroid: false,
|
|
12
12
|
isIos: false,
|
|
13
|
-
|
|
14
|
-
isChromeBrowser: false,
|
|
13
|
+
browser: 'other',
|
|
15
14
|
});
|
|
16
15
|
assert.deepStrictEqual(compatibility, {
|
|
17
16
|
isMobile: true,
|
|
@@ -31,8 +30,7 @@ describe('getMightFail', () => {
|
|
|
31
30
|
isIncognito: false,
|
|
32
31
|
isAndroid: false,
|
|
33
32
|
isIos: false,
|
|
34
|
-
|
|
35
|
-
isChromeBrowser: false,
|
|
33
|
+
browser: 'other',
|
|
36
34
|
});
|
|
37
35
|
assert.ok(mightFail === false);
|
|
38
36
|
});
|
|
@@ -44,8 +42,7 @@ describe('getMightFail', () => {
|
|
|
44
42
|
isIncognito: false,
|
|
45
43
|
isAndroid: false,
|
|
46
44
|
isIos: false,
|
|
47
|
-
|
|
48
|
-
isChromeBrowser: false,
|
|
45
|
+
browser: 'other',
|
|
49
46
|
});
|
|
50
47
|
assert.ok(mightFail === false);
|
|
51
48
|
});
|
|
@@ -57,8 +54,7 @@ describe('getMightFail', () => {
|
|
|
57
54
|
isIncognito: true,
|
|
58
55
|
isAndroid: true,
|
|
59
56
|
isIos: false,
|
|
60
|
-
|
|
61
|
-
isChromeBrowser: true,
|
|
57
|
+
browser: 'chrome',
|
|
62
58
|
});
|
|
63
59
|
assert.ok(mightFail === true);
|
|
64
60
|
});
|
|
@@ -70,8 +66,7 @@ describe('getMightFail', () => {
|
|
|
70
66
|
isIncognito: true,
|
|
71
67
|
isAndroid: true,
|
|
72
68
|
isIos: false,
|
|
73
|
-
|
|
74
|
-
isChromeBrowser: true,
|
|
69
|
+
browser: 'chrome',
|
|
75
70
|
});
|
|
76
71
|
assert.ok(mightFail === false);
|
|
77
72
|
});
|
|
@@ -83,8 +78,7 @@ describe('getMightFail', () => {
|
|
|
83
78
|
isIncognito: false,
|
|
84
79
|
isAndroid: true,
|
|
85
80
|
isIos: false,
|
|
86
|
-
|
|
87
|
-
isChromeBrowser: false,
|
|
81
|
+
browser: 'samsung',
|
|
88
82
|
});
|
|
89
83
|
assert.ok(mightFail === true);
|
|
90
84
|
});
|
|
@@ -96,8 +90,7 @@ describe('getMightFail', () => {
|
|
|
96
90
|
isIncognito: true,
|
|
97
91
|
isAndroid: false,
|
|
98
92
|
isIos: true,
|
|
99
|
-
|
|
100
|
-
isChromeBrowser: false,
|
|
93
|
+
browser: 'safari',
|
|
101
94
|
});
|
|
102
95
|
assert.ok(mightFail === true);
|
|
103
96
|
});
|
|
@@ -109,8 +102,7 @@ describe('getMightFail', () => {
|
|
|
109
102
|
isIncognito: true,
|
|
110
103
|
isAndroid: false,
|
|
111
104
|
isIos: true,
|
|
112
|
-
|
|
113
|
-
isChromeBrowser: false,
|
|
105
|
+
browser: 'safari',
|
|
114
106
|
});
|
|
115
107
|
assert.ok(mightFail === false);
|
|
116
108
|
});
|
|
@@ -122,8 +114,7 @@ describe('getMightFail', () => {
|
|
|
122
114
|
isIncognito: false,
|
|
123
115
|
isAndroid: false,
|
|
124
116
|
isIos: false,
|
|
125
|
-
|
|
126
|
-
isChromeBrowser: false,
|
|
117
|
+
browser: 'other',
|
|
127
118
|
});
|
|
128
119
|
assert.ok(mightFail === false);
|
|
129
120
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@connectid-tools/idp-selector-react",
|
|
3
|
-
"version": "6.10.0-alpha.
|
|
3
|
+
"version": "6.10.0-alpha.5",
|
|
4
4
|
"description": "React component for IDP Selector.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,12 +26,12 @@
|
|
|
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.
|
|
29
|
+
"@types/node": "^22.15.33",
|
|
30
30
|
"@types/react": "^18.3.23",
|
|
31
31
|
"@types/react-dom": "^18.3.7",
|
|
32
32
|
"cypress": "^14.5.0",
|
|
33
33
|
"jest-environment-jsdom": "^29.7.0",
|
|
34
|
-
"prettier": "^3.
|
|
34
|
+
"prettier": "^3.6.0",
|
|
35
35
|
"react": "^18.3.1",
|
|
36
36
|
"react-dom": "^18.3.1",
|
|
37
37
|
"replace-in-file": "^8.3.0",
|
package/types.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export type CidButtonTypeConfig = {
|
|
|
38
38
|
hasHowItWorks: boolean;
|
|
39
39
|
hasLearnMore: boolean;
|
|
40
40
|
};
|
|
41
|
+
export type Browser = 'chrome' | 'samsung' | 'safari' | 'firefox' | 'other';
|
|
41
42
|
export type CompatibilityEnvironment = {
|
|
42
43
|
supportIncognito: boolean;
|
|
43
44
|
isMobile: boolean;
|
|
@@ -45,13 +46,12 @@ export type CompatibilityEnvironment = {
|
|
|
45
46
|
idpHasAppCertification: boolean;
|
|
46
47
|
isAndroid: boolean;
|
|
47
48
|
isIos: boolean;
|
|
48
|
-
|
|
49
|
-
isChromeBrowser: boolean;
|
|
49
|
+
browser: Browser;
|
|
50
50
|
};
|
|
51
51
|
export type CompatibilityWarnings = {
|
|
52
52
|
mightFail: boolean;
|
|
53
53
|
isMobile: boolean;
|
|
54
54
|
isIncognito: boolean;
|
|
55
55
|
mobileOs: 'android' | 'ios' | 'other';
|
|
56
|
-
browser:
|
|
56
|
+
browser: Browser;
|
|
57
57
|
};
|
package/userAgent.d.ts
CHANGED
|
@@ -2,6 +2,4 @@ import { Device } from './types';
|
|
|
2
2
|
export declare const getDeviceType: () => Device;
|
|
3
3
|
export declare const isAndroid: () => boolean;
|
|
4
4
|
export declare const isIos: () => boolean;
|
|
5
|
-
export declare const isChromeBrowser: () => boolean;
|
|
6
|
-
export declare const isSamsungBrowser: () => boolean;
|
|
7
5
|
export declare const getBrowserName: () => "other" | "chrome" | "samsung" | "safari" | "firefox";
|
package/userAgent.js
CHANGED
|
@@ -10,8 +10,6 @@ export const getDeviceType = () => {
|
|
|
10
10
|
};
|
|
11
11
|
export const isAndroid = () => /Android/i.test(navigator.userAgent);
|
|
12
12
|
export const isIos = () => /iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
13
|
-
export const isChromeBrowser = () => /Chrome/.test(navigator.userAgent) && !/Edg|OPR|Brave/.test(navigator.userAgent);
|
|
14
|
-
export const isSamsungBrowser = () => /SamsungBrowser/.test(navigator.userAgent);
|
|
15
13
|
export const getBrowserName = () => {
|
|
16
14
|
const ua = navigator.userAgent.toLowerCase();
|
|
17
15
|
if (ua.includes('samsungbrowser')) {
|