@connectid-tools/idp-selector-react 6.10.0-alpha.0 → 6.10.0-alpha.2

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  import './CidButton.css';
2
2
  import './global.css';
3
- import { CertificationStatus, CidButtonLabel, CidButtonSize, CidButtonTheme, CidButtonType, Claim, CompabilityWarnings, IntroTextType, LogoMode, RequiredCertification } from './types';
3
+ import { CertificationStatus, CidButtonLabel, CidButtonSize, CidButtonTheme, CidButtonType, Claim, CompatibilityWarnings, IntroTextType, LogoMode, RequiredCertification } from './types';
4
4
  type CidButtonProps = {
5
- onProceed: (authorisationServerId: string, compabilityWarnings: CompabilityWarnings) => void;
5
+ onProceed: (authorisationServerId: string, compatibilityWarnings: CompatibilityWarnings) => void;
6
6
  claims: Claim[];
7
7
  requiredClaims?: Claim[];
8
8
  rpLogoUrl?: string;
@@ -21,6 +21,7 @@ type CidButtonProps = {
21
21
  logoLockupStyle?: LogoMode;
22
22
  showInfoContent?: boolean;
23
23
  onError?: (error: string) => void;
24
+ showCompatibilityWarnings?: boolean;
24
25
  forceMobile?: boolean;
25
26
  forceIos?: boolean;
26
27
  forceAndroid?: boolean;
package/CidButton.js CHANGED
@@ -29,8 +29,8 @@ import { isIntroTextTypeValid, isRequiredClaimsValid } from './validator';
29
29
  import detectIncognito from './incognito';
30
30
  import { getDeviceType, isAndroid, isChromeBrowser, isIos, isSamsungBrowser } from './userAgent';
31
31
  import { hasCertification } from './certification';
32
- import { getCompability } from './compability';
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 = () => { }, forceMobile = false, // only for testing purposes
32
+ import { getCompatibility } from './compatibility';
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, 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
@@ -119,12 +119,18 @@ forceIncognito = false, // only for testing purposes
119
119
  });
120
120
  track();
121
121
  }, []);
122
+ const getCompatibilityConfirmText = (compatibilityWarnings) => {
123
+ if (compatibilityWarnings.mobileOs === 'android' && compatibilityWarnings.browser === 'samsung') {
124
+ return 'It looks like you are using Samsung Browser. This generally will not work - we suggest using Chrome and trying again.\nClick on "Cancel" to abort or "OK" to proceed.';
125
+ }
126
+ return 'It looks like you are in incognito mode. This generally will not work - we suggest switching out of incognito mode and trying again.\nClick on "Cancel" to abort or "OK" to proceed.';
127
+ };
122
128
  const handleOnProceed = (authorisationServerId, authorisationServerName, authorisationServerCertifications) => {
123
129
  analytics === null || analytics === void 0 ? void 0 : analytics.track('IDP Selected', Object.assign(Object.assign({}, analyticsData), { authorisationServerId, idp_name: authorisationServerName, incognito: isIncognito }));
124
130
  setShowPopup(false);
125
131
  const isMobile = forceMobile || getDeviceType() === 'mobile';
126
132
  const idpHasAppCertification = hasCertification(authorisationServerCertifications, 'Channel', 'app');
127
- const compability = getCompability({
133
+ const compatibility = getCompatibility({
128
134
  idpHasAppCertification,
129
135
  isMobile,
130
136
  isIncognito: forceIncognito || !!isIncognito,
@@ -133,7 +139,17 @@ forceIncognito = false, // only for testing purposes
133
139
  isSamsungBrowser: isSamsungBrowser(),
134
140
  isChromeBrowser: isChromeBrowser(),
135
141
  });
136
- onProceed(authorisationServerId, compability);
142
+ if (showCompatibilityWarnings && compatibility.mightFail) {
143
+ const confirmText = getCompatibilityConfirmText(compatibility);
144
+ if (confirm(confirmText)) {
145
+ onProceed(authorisationServerId, compatibility);
146
+ }
147
+ else {
148
+ setShowPopup(true);
149
+ }
150
+ return;
151
+ }
152
+ onProceed(authorisationServerId, compatibility);
137
153
  };
138
154
  const handleButtonClick = () => {
139
155
  setShowPopup(true);
package/README.md CHANGED
@@ -14,7 +14,7 @@ Place the `<CidButton>` component where you want to render the ConnectID button
14
14
  import { CidButton } from '@connectid-tools/idp-selector-react'
15
15
 
16
16
  <CidButton
17
- onProceed={(authorisationServerClicked: string, compabilityWarnings: CompabilityWarnings) => {
17
+ onProceed={(authorisationServerClicked: string, compatibilityWarnings: CompatibilityWarnings) => {
18
18
  /* do something here */
19
19
  }}
20
20
  claims={['email']}
@@ -31,7 +31,7 @@ Your page should render a widget similar to this 👇 And when the button is cli
31
31
 
32
32
  | key | description | type | required | default |
33
33
  | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------- |
34
- | onProceed | Callback to be called when IDP Selector `Proceed` button is clicked | (authorisationServerId: string, compabilityWarnings: CompabilityWarnings) => void | yes | - |
34
+ | onProceed | Callback to be called when IDP Selector `Proceed` button is clicked | (authorisationServerId: string, compatibilityWarnings: CompatibilityWarnings) => void | yes | - |
35
35
  | claims | List of claims to be displayed to the user and will be requested from IDP to be shared. If `requiredClaims` not supplied then only IDPs that support all listed `claims` will be displayed to the user. | Claim[] | yes | - |
36
36
  | requiredClaims | List of claims to be supported by IDPs. Must be a subset of `claims`. Where an RP can successfully complete their use case without all claims specified in `claims`, they can specify `requiredClaims` with the minimum list of claims needed, which will then be used for filtering and may result in additional IDP options being displayed to the customer. | Claim[] | no (`claims` will be used if no `requiredClaims`) | - |
37
37
  | label | The button label. Do not use 'Sign Up'. It is deprecated. | 'Verify' \| 'Login' \| 'Sign Up' \| 'Age check' \| 'Sign up' \| 'Authenticate' \| 'Checkout' | no | 'Verify' |
@@ -50,11 +50,12 @@ Your page should render a widget similar to this 👇 And when the button is cli
50
50
  | logoLockupStyle | Logo lockup theme | 'dark' \| 'light' | no | 'light' |
51
51
  | showInfoContent | The text that goes below the ConnectID button [More details here](#infoContent) | boolean | false | false |
52
52
  | onError | Callback to be called when there is an error fetching participants or invalid options. | () => void | no | () => {} // do nothing |
53
+ | showCompatibilityWarnings | Whether to show compatibility warnings or not. If set to `true` a popup with compatibility message will show up after an IDP is selected (if conditions are met) [More details here](#showCompatibilityWarnings) | boolean | no | false |
53
54
 
54
- #### CompabilityWarnings type
55
+ #### CompatibilityWarnings type
55
56
 
56
57
  ```typescript
57
- export type CompabilityWarnings = {
58
+ export type CompatibilityWarnings = {
58
59
  mightFail: boolean
59
60
  isMobile: boolean
60
61
  isIncognito: boolean
@@ -219,6 +220,16 @@ This is an optional field in addition with the widgets below the ConnectID butto
219
220
  ![](/images/readme_below_button.png 'Below information content')
220
221
  </details>
221
222
 
223
+ ### <a name="showCompatibilityWarnings"></a>showCompatibilityWarnings option
224
+
225
+ If set to `true`, a popup with compatibility warnings will be displayed after an IDP is selected, if the conditions are met. The popup will show information about the compatibility of the user's browser, device, incognito/private mode with the ConnectID flow and the user can decide whether they want to proceed or not.
226
+
227
+ <details>
228
+ <summary>Show compatibility warnings</summary>
229
+
230
+ ![](/images/readme_compatibility_warnings.png 'Compatibility warnings')
231
+ </details>
232
+
222
233
 
223
234
  ### <a name="logoLockupStyle"></a>logoLockup option
224
235
 
@@ -241,6 +252,12 @@ The SVG image below the ConnectID button has either option dark or light mode. B
241
252
 
242
253
  ## 🚀 Release Notes
243
254
 
255
+ ### 6.10.0-alpha.2 (Jun 17, 2025)
256
+ - Add `showCompatibilityWarnings` option.
257
+
258
+ ### 6.10.0-alpha.1 (Jun 12, 2025)
259
+ - Rename `compabilityWarnings` to `compatibilityWarnings`.
260
+
244
261
  ### 6.10.0-alpha.0 (Jun 10, 2025)
245
262
  - Add `compabilityWarnings` to `onProceed` callback.
246
263
 
@@ -1,9 +1,9 @@
1
1
  import { describe, it } from 'node:test';
2
2
  import assert from 'node:assert';
3
- import { getCompability, getMightFail } from './compability';
4
- describe('getCompability', () => {
5
- it('should return compability warnings', () => {
6
- const compability = getCompability({
3
+ import { getCompatibility, getMightFail } from './compatibility';
4
+ describe('getCompatibility', () => {
5
+ it('should return compatibility warnings', () => {
6
+ const compatibility = getCompatibility({
7
7
  idpHasAppCertification: true,
8
8
  isMobile: true,
9
9
  isIncognito: false,
@@ -12,7 +12,7 @@ describe('getCompability', () => {
12
12
  isSamsungBrowser: false,
13
13
  isChromeBrowser: false,
14
14
  });
15
- assert.deepStrictEqual(compability, {
15
+ assert.deepStrictEqual(compatibility, {
16
16
  isMobile: true,
17
17
  isIncognito: false,
18
18
  mobileOs: 'other',
@@ -0,0 +1,3 @@
1
+ import { CompatibilityEnvironment, CompatibilityWarnings } from './types';
2
+ export declare const getCompatibility: (env: CompatibilityEnvironment) => CompatibilityWarnings;
3
+ export declare const getMightFail: (env: Pick<CompatibilityEnvironment, "idpHasAppCertification" | "isMobile" | "isIncognito" | "isAndroid" | "isIos" | "isSamsungBrowser" | "isChromeBrowser">) => boolean;
@@ -1,5 +1,5 @@
1
1
  import { getBrowserName } from './userAgent';
2
- export const getCompability = (env) => {
2
+ export const getCompatibility = (env) => {
3
3
  const { idpHasAppCertification, isAndroid, isChromeBrowser, isIncognito, isMobile, isSamsungBrowser, isIos } = env;
4
4
  const mightFail = getMightFail({
5
5
  idpHasAppCertification,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectid-tools/idp-selector-react",
3
- "version": "6.10.0-alpha.0",
3
+ "version": "6.10.0-alpha.2",
4
4
  "description": "React component for IDP Selector.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,16 +26,16 @@
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.31",
29
+ "@types/node": "^22.15.32",
30
30
  "@types/react": "^18.3.23",
31
31
  "@types/react-dom": "^18.3.7",
32
- "cypress": "^14.4.1",
32
+ "cypress": "^14.5.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.4",
38
+ "tsx": "^4.20.3",
39
39
  "typescript": "^5.8.3"
40
40
  },
41
41
  "dependencies": {
package/types.d.ts CHANGED
@@ -38,7 +38,7 @@ export type CidButtonTypeConfig = {
38
38
  hasHowItWorks: boolean;
39
39
  hasLearnMore: boolean;
40
40
  };
41
- export type CompabilityEnvironment = {
41
+ export type CompatibilityEnvironment = {
42
42
  isMobile: boolean;
43
43
  isIncognito: boolean;
44
44
  idpHasAppCertification: boolean;
@@ -47,7 +47,7 @@ export type CompabilityEnvironment = {
47
47
  isSamsungBrowser: boolean;
48
48
  isChromeBrowser: boolean;
49
49
  };
50
- export type CompabilityWarnings = {
50
+ export type CompatibilityWarnings = {
51
51
  mightFail: boolean;
52
52
  isMobile: boolean;
53
53
  isIncognito: boolean;
package/compability.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { CompabilityEnvironment, CompabilityWarnings } from './types';
2
- export declare const getCompability: (env: CompabilityEnvironment) => CompabilityWarnings;
3
- export declare const getMightFail: (env: Pick<CompabilityEnvironment, "idpHasAppCertification" | "isMobile" | "isIncognito" | "isAndroid" | "isIos" | "isSamsungBrowser" | "isChromeBrowser">) => boolean;