@connectid-tools/idp-selector-react 6.10.0-alpha.3 → 6.10.0-alpha.4
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 +3 -3
- package/README.md +3 -0
- package/compatibility.d.ts +1 -1
- package/compatibility.js +6 -8
- package/compatibility.test.js +9 -18
- package/package.json +1 -1
- 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
|
@@ -27,13 +27,14 @@ 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
33
|
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
34
|
forceIos = false, // only for testing purposes
|
|
35
35
|
forceAndroid = false, // only for testing purposes
|
|
36
36
|
forceIncognito = false, // only for testing purposes
|
|
37
|
+
forceBrowser = undefined, // only for testing purposes
|
|
37
38
|
}) => {
|
|
38
39
|
const { data: participants, error, isLoading, } = useSWR(participantsUri, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
40
|
const response = yield fetch(participantsUri);
|
|
@@ -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/README.md
CHANGED
|
@@ -259,6 +259,9 @@ 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.4 (Jun 20, 2025)
|
|
263
|
+
- Add test support for Samsung and Chrome browsers.
|
|
264
|
+
|
|
262
265
|
### 6.10.0-alpha.3 (Jun 20, 2025)
|
|
263
266
|
- Add `supportIncognito` option.
|
|
264
267
|
|
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
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')) {
|