@connectid-tools/idp-selector-react 6.10.0-alpha.5 → 6.10.0-alpha.7

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
@@ -23,6 +23,7 @@ type CidButtonProps = {
23
23
  onError?: (error: string) => void;
24
24
  showCompatibilityWarnings?: boolean;
25
25
  supportIncognito?: boolean;
26
+ disableAnalytics?: boolean;
26
27
  forceMobile?: boolean;
27
28
  forceIos?: boolean;
28
29
  forceAndroid?: boolean;
package/CidButton.js CHANGED
@@ -30,8 +30,7 @@ import detectIncognito from './incognito';
30
30
  import { getBrowserName, getDeviceType, isAndroid, isIos } from './userAgent';
31
31
  import { hasCertification } from './certification';
32
32
  import { getCompatibility } from './compatibility';
33
- initialiseAnalytics();
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
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, disableAnalytics = false, forceMobile = false, // only for testing purposes
35
34
  forceIos = false, // only for testing purposes
36
35
  forceAndroid = false, // only for testing purposes
37
36
  forceIncognito = false, // only for testing purposes
@@ -116,8 +115,14 @@ forceBrowser = undefined, // only for testing purposes
116
115
  setIsIncognito(undefined);
117
116
  incognito = undefined;
118
117
  }
119
- analytics === null || analytics === void 0 ? void 0 : analytics.track('ConnectID Button Displayed', Object.assign(Object.assign({}, analyticsData), { incognito }));
118
+ initialiseAnalytics((analytics) => {
119
+ if (typeof analytics !== 'undefined') {
120
+ analytics.track('ConnectID Button Displayed', Object.assign(Object.assign({}, analyticsData), { incognito }));
121
+ }
122
+ });
120
123
  });
124
+ if (disableAnalytics)
125
+ return;
121
126
  track();
122
127
  }, []);
123
128
  const getCompatibilityConfirmText = (compatibilityWarnings) => {
@@ -127,7 +132,9 @@ forceBrowser = undefined, // only for testing purposes
127
132
  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.';
128
133
  };
129
134
  const handleOnProceed = (authorisationServerId, authorisationServerName, authorisationServerCertifications) => {
130
- analytics === null || analytics === void 0 ? void 0 : analytics.track('IDP Selected', Object.assign(Object.assign({}, analyticsData), { authorisationServerId, idp_name: authorisationServerName, incognito: isIncognito }));
135
+ if (typeof analytics !== 'undefined') {
136
+ analytics.track('IDP Selected', Object.assign(Object.assign({}, analyticsData), { authorisationServerId, idp_name: authorisationServerName, incognito: isIncognito }));
137
+ }
131
138
  setShowPopup(false);
132
139
  const isMobile = forceMobile || getDeviceType() === 'mobile';
133
140
  const idpHasAppCertification = hasCertification(authorisationServerCertifications, 'Channel', 'app');
@@ -154,11 +161,15 @@ forceBrowser = undefined, // only for testing purposes
154
161
  };
155
162
  const handleButtonClick = () => {
156
163
  setShowPopup(true);
157
- analytics === null || analytics === void 0 ? void 0 : analytics.track('ConnectID Button Clicked', Object.assign(Object.assign({}, analyticsData), { incognito: isIncognito }));
164
+ if (typeof analytics !== 'undefined') {
165
+ analytics.track('ConnectID Button Clicked', Object.assign(Object.assign({}, analyticsData), { incognito: isIncognito }));
166
+ }
158
167
  };
159
168
  const handleClosePopup = () => {
160
169
  setShowPopup(false);
161
- analytics === null || analytics === void 0 ? void 0 : analytics.track('IDP Selector Popup Close Button Clicked', Object.assign(Object.assign({}, analyticsData), { incognito: isIncognito }));
170
+ if (typeof analytics !== 'undefined') {
171
+ analytics.track('IDP Selector Popup Close Button Clicked', Object.assign(Object.assign({}, analyticsData), { incognito: isIncognito }));
172
+ }
162
173
  };
163
174
  if (!isRequiredClaimsValid(claims, requiredClaims)) {
164
175
  const errorMessage = `requiredClaims needs to be a subset of claims. claims: ${claims.join(', ')}; requiredClaims: ${requiredClaims === null || requiredClaims === void 0 ? void 0 : requiredClaims.join(', ')}.`;
@@ -6,13 +6,13 @@ import { useContext } from 'react';
6
6
  export const CidButtonHowItWorks = () => {
7
7
  const theme = useContext(ThemeContext);
8
8
  const handleClick = () => {
9
- if (!analytics)
10
- return;
11
- analytics.track('Link to External Page Clicked', {
12
- source: 'how_does_it_work',
13
- link_url: 'https://connectid.com.au/#use-cases',
14
- rp_sub_brand: getCurrentUrlOrigin(),
15
- });
9
+ if (typeof analytics !== 'undefined') {
10
+ analytics.track('Link to External Page Clicked', {
11
+ source: 'how_does_it_work',
12
+ link_url: 'https://connectid.com.au/#use-cases',
13
+ rp_sub_brand: getCurrentUrlOrigin(),
14
+ });
15
+ }
16
16
  };
17
17
  return (_jsx("a", { href: "https://connectid.com.au/#use-cases", onClick: handleClick, target: "_blank", tabIndex: 0, className: `cid-idp-selector-how-it-works ${theme === 'light' ? 'cid-idp-selector-how-it-works--light' : ''}`, "data-testid": "how-it-works", children: "How does it work?" }));
18
18
  };
package/IdpLogoList.js CHANGED
@@ -12,5 +12,5 @@ export const IdpLogoList = ({ loading, logoLockupStyle }) => {
12
12
  const isDarkMode = logoLockupStyle === 'dark';
13
13
  const imgSrc = isDarkMode ? logoLockupUrl.dark : logoLockupUrl.light;
14
14
  const dataTestId = isDarkMode ? 'logo-lockup-dark' : 'logo-lockup-light';
15
- return (_jsx("div", { className: "cid-idp-selector-idp-logo-list-wrapper", "data-testid": "idp-logo-list-wrapper", children: _jsx("img", { "data-testid": dataTestId, className: "cid-logo-lockup", src: imgSrc, alt: "List of available providers" }) }));
15
+ return (_jsx("div", { className: "cid-idp-selector-idp-logo-list-wrapper", "data-testid": "idp-logo-list-wrapper", children: _jsx("img", { "data-testid": dataTestId, className: "cid-logo-lockup", src: imgSrc, alt: "Available on: CommBank, NAB, ANZ Plus and Westpac" }) }));
16
16
  };
package/LearnMore.js CHANGED
@@ -6,13 +6,13 @@ import { getCurrentUrlOrigin } from './navigator';
6
6
  export const LearnMore = () => {
7
7
  const theme = useContext(ThemeContext);
8
8
  const handleClick = () => {
9
- if (!analytics)
10
- return;
11
- analytics.track('Link to External Page Clicked', {
12
- source: 'learn_more',
13
- link_url: 'https://www.connectid.com.au',
14
- rp_sub_brand: getCurrentUrlOrigin(),
15
- });
9
+ if (typeof analytics !== 'undefined') {
10
+ analytics.track('Link to External Page Clicked', {
11
+ source: 'learn_more',
12
+ link_url: 'https://www.connectid.com.au',
13
+ rp_sub_brand: getCurrentUrlOrigin(),
14
+ });
15
+ }
16
16
  };
17
17
  return (_jsxs("div", { className: `cid-idp-selector-learn-more ${theme === 'light' ? 'cid-idp-selector-learn-more--light' : ''}`, children: ["Visit", ' ', _jsx("a", { href: "https://www.connectid.com.au", onClick: handleClick, target: "_blank", tabIndex: 0, "data-testid": "learn-more", children: "connectid.com.au" }), ' ', "to learn more."] }));
18
18
  };
package/Popup.js CHANGED
@@ -99,12 +99,14 @@ export const Popup = ({ onProceed, onCancel, onError, claims, requiredClaims, sh
99
99
  }
100
100
  };
101
101
  const handleConnectIdLinkClicked = () => __awaiter(void 0, void 0, void 0, function* () {
102
- analytics === null || analytics === void 0 ? void 0 : analytics.track('Link to External Page Clicked', {
103
- source: 'what_is_connectid',
104
- link_url: 'https://www.connectid.com.au',
105
- rp_sub_brand: getCurrentUrlOrigin(),
106
- incognito: isIncognito,
107
- });
102
+ if (typeof analytics !== 'undefined') {
103
+ analytics.track('Link to External Page Clicked', {
104
+ source: 'what_is_connectid',
105
+ link_url: 'https://www.connectid.com.au',
106
+ rp_sub_brand: getCurrentUrlOrigin(),
107
+ incognito: isIncognito,
108
+ });
109
+ }
108
110
  });
109
111
  const renderClaimList = () => {
110
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))) }));
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.7 (Jun 27, 2025)
263
+ - Fix bank logos `alt` attribute.
264
+
265
+ ### 6.10.0-alpha.6 (Jun 26, 2025)
266
+ - Add `disableAnalytics` option.
267
+
262
268
  ### 6.10.0-alpha.5 (Jun 25, 2025)
263
269
  - Fix analytics double loading.
264
270
 
package/analytics.d.ts CHANGED
@@ -1 +1,2 @@
1
- export declare const initialiseAnalytics: () => void;
1
+ import { Analytics } from "./types";
2
+ export declare const initialiseAnalytics: (onLoad: (analytics: Analytics) => void) => void;
package/analytics.js CHANGED
@@ -1,8 +1,11 @@
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 initialiseAnalytics = () => {
5
- // copied from https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/
4
+ export const initialiseAnalytics = (onLoad) => {
5
+ // adapted from https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/
6
+ // to handle RSC
7
+ if (typeof window === 'undefined')
8
+ return;
6
9
  // @ts-ignore
7
10
  // Create a queue, but don't obliterate an existing one!
8
11
  var analytics = (window.analytics = window.analytics || []);
@@ -74,6 +77,9 @@ export const initialiseAnalytics = () => {
74
77
  // @ts-ignore
75
78
  first.parentNode.insertBefore(script, first);
76
79
  analytics._loadOptions = options;
80
+ script.onload = function () {
81
+ onLoad(analytics);
82
+ };
77
83
  };
78
84
  analytics._writeKey = WRITE_KEY;
79
85
  // Add a version to keep track of what's in the wild.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectid-tools/idp-selector-react",
3
- "version": "6.10.0-alpha.5",
3
+ "version": "6.10.0-alpha.7",
4
4
  "description": "React component for IDP Selector.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
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.6.0",
34
+ "prettier": "^3.6.1",
35
35
  "react": "^18.3.1",
36
36
  "react-dom": "^18.3.1",
37
37
  "replace-in-file": "^8.3.0",