@feelflow/ffid-sdk 1.6.0 → 1.6.1

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.
@@ -1294,6 +1294,10 @@ function FFIDUserMenu({
1294
1294
  }) {
1295
1295
  const { user, currentOrganization, logout, isLoading, isAuthenticated } = useFFID();
1296
1296
  const [isOpen, setIsOpen] = react.useState(false);
1297
+ const [avatarError, setAvatarError] = react.useState(false);
1298
+ react.useEffect(() => {
1299
+ setAvatarError(false);
1300
+ }, [user?.avatarUrl]);
1297
1301
  if (!isAuthenticated || !user) {
1298
1302
  return null;
1299
1303
  }
@@ -1330,7 +1334,16 @@ function FFIDUserMenu({
1330
1334
  children: displayName.charAt(0).toUpperCase()
1331
1335
  }
1332
1336
  );
1333
- const avatarElement = renderAvatar ? renderAvatar({ avatarUrl: user.avatarUrl, displayName: user.displayName, email: user.email }) : user.avatarUrl && isValidAvatarUrl(user.avatarUrl) ? /* @__PURE__ */ jsxRuntime.jsx("img", { className: classNames.avatar, src: user.avatarUrl, alt: displayName, style: { width: SIZE_AVATAR_MD, height: SIZE_AVATAR_MD, borderRadius: "50%" } }) : defaultAvatar;
1337
+ const avatarElement = renderAvatar ? renderAvatar({ avatarUrl: user.avatarUrl, displayName: user.displayName, email: user.email }) : user.avatarUrl && isValidAvatarUrl(user.avatarUrl) && !avatarError ? /* @__PURE__ */ jsxRuntime.jsx(
1338
+ "img",
1339
+ {
1340
+ className: classNames.avatar,
1341
+ src: user.avatarUrl,
1342
+ alt: displayName,
1343
+ onError: () => setAvatarError(true),
1344
+ style: { width: SIZE_AVATAR_MD, height: SIZE_AVATAR_MD, borderRadius: "50%" }
1345
+ }
1346
+ ) : defaultAvatar;
1334
1347
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: [className, classNames.container].filter(Boolean).join(" ") || void 0, style: { position: "relative" }, children: [
1335
1348
  /* @__PURE__ */ jsxRuntime.jsx(
1336
1349
  "button",
@@ -1292,6 +1292,10 @@ function FFIDUserMenu({
1292
1292
  }) {
1293
1293
  const { user, currentOrganization, logout, isLoading, isAuthenticated } = useFFID();
1294
1294
  const [isOpen, setIsOpen] = useState(false);
1295
+ const [avatarError, setAvatarError] = useState(false);
1296
+ useEffect(() => {
1297
+ setAvatarError(false);
1298
+ }, [user?.avatarUrl]);
1295
1299
  if (!isAuthenticated || !user) {
1296
1300
  return null;
1297
1301
  }
@@ -1328,7 +1332,16 @@ function FFIDUserMenu({
1328
1332
  children: displayName.charAt(0).toUpperCase()
1329
1333
  }
1330
1334
  );
1331
- const avatarElement = renderAvatar ? renderAvatar({ avatarUrl: user.avatarUrl, displayName: user.displayName, email: user.email }) : user.avatarUrl && isValidAvatarUrl(user.avatarUrl) ? /* @__PURE__ */ jsx("img", { className: classNames.avatar, src: user.avatarUrl, alt: displayName, style: { width: SIZE_AVATAR_MD, height: SIZE_AVATAR_MD, borderRadius: "50%" } }) : defaultAvatar;
1335
+ const avatarElement = renderAvatar ? renderAvatar({ avatarUrl: user.avatarUrl, displayName: user.displayName, email: user.email }) : user.avatarUrl && isValidAvatarUrl(user.avatarUrl) && !avatarError ? /* @__PURE__ */ jsx(
1336
+ "img",
1337
+ {
1338
+ className: classNames.avatar,
1339
+ src: user.avatarUrl,
1340
+ alt: displayName,
1341
+ onError: () => setAvatarError(true),
1342
+ style: { width: SIZE_AVATAR_MD, height: SIZE_AVATAR_MD, borderRadius: "50%" }
1343
+ }
1344
+ ) : defaultAvatar;
1332
1345
  return /* @__PURE__ */ jsxs("div", { className: [className, classNames.container].filter(Boolean).join(" ") || void 0, style: { position: "relative" }, children: [
1333
1346
  /* @__PURE__ */ jsx(
1334
1347
  "button",
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunkLILTOMJP_cjs = require('../chunk-LILTOMJP.cjs');
3
+ var chunkC254ATU6_cjs = require('../chunk-C254ATU6.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
8
8
  enumerable: true,
9
- get: function () { return chunkLILTOMJP_cjs.FFIDAnnouncementBadge; }
9
+ get: function () { return chunkC254ATU6_cjs.FFIDAnnouncementBadge; }
10
10
  });
11
11
  Object.defineProperty(exports, "FFIDAnnouncementList", {
12
12
  enumerable: true,
13
- get: function () { return chunkLILTOMJP_cjs.FFIDAnnouncementList; }
13
+ get: function () { return chunkC254ATU6_cjs.FFIDAnnouncementList; }
14
14
  });
15
15
  Object.defineProperty(exports, "FFIDLoginButton", {
16
16
  enumerable: true,
17
- get: function () { return chunkLILTOMJP_cjs.FFIDLoginButton; }
17
+ get: function () { return chunkC254ATU6_cjs.FFIDLoginButton; }
18
18
  });
19
19
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
20
20
  enumerable: true,
21
- get: function () { return chunkLILTOMJP_cjs.FFIDOrganizationSwitcher; }
21
+ get: function () { return chunkC254ATU6_cjs.FFIDOrganizationSwitcher; }
22
22
  });
23
23
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
24
24
  enumerable: true,
25
- get: function () { return chunkLILTOMJP_cjs.FFIDSubscriptionBadge; }
25
+ get: function () { return chunkC254ATU6_cjs.FFIDSubscriptionBadge; }
26
26
  });
27
27
  Object.defineProperty(exports, "FFIDUserMenu", {
28
28
  enumerable: true,
29
- get: function () { return chunkLILTOMJP_cjs.FFIDUserMenu; }
29
+ get: function () { return chunkC254ATU6_cjs.FFIDUserMenu; }
30
30
  });
@@ -1 +1 @@
1
- export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-4LSSBFZG.js';
1
+ export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-Q5XWUQHV.js';
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkLILTOMJP_cjs = require('./chunk-LILTOMJP.cjs');
3
+ var chunkC254ATU6_cjs = require('./chunk-C254ATU6.cjs');
4
4
  var react = require('react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
7
7
  function withFFIDAuth(Component, options = {}) {
8
8
  const WrappedComponent = (props) => {
9
- const { isLoading, isAuthenticated, login } = chunkLILTOMJP_cjs.useFFIDContext();
9
+ const { isLoading, isAuthenticated, login } = chunkC254ATU6_cjs.useFFIDContext();
10
10
  const hasRedirected = react.useRef(false);
11
11
  react.useEffect(() => {
12
12
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -31,82 +31,82 @@ function withFFIDAuth(Component, options = {}) {
31
31
 
32
32
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
33
33
  enumerable: true,
34
- get: function () { return chunkLILTOMJP_cjs.DEFAULT_API_BASE_URL; }
34
+ get: function () { return chunkC254ATU6_cjs.DEFAULT_API_BASE_URL; }
35
35
  });
36
36
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
37
37
  enumerable: true,
38
- get: function () { return chunkLILTOMJP_cjs.FFIDAnnouncementBadge; }
38
+ get: function () { return chunkC254ATU6_cjs.FFIDAnnouncementBadge; }
39
39
  });
40
40
  Object.defineProperty(exports, "FFIDAnnouncementList", {
41
41
  enumerable: true,
42
- get: function () { return chunkLILTOMJP_cjs.FFIDAnnouncementList; }
42
+ get: function () { return chunkC254ATU6_cjs.FFIDAnnouncementList; }
43
43
  });
44
44
  Object.defineProperty(exports, "FFIDLoginButton", {
45
45
  enumerable: true,
46
- get: function () { return chunkLILTOMJP_cjs.FFIDLoginButton; }
46
+ get: function () { return chunkC254ATU6_cjs.FFIDLoginButton; }
47
47
  });
48
48
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
49
49
  enumerable: true,
50
- get: function () { return chunkLILTOMJP_cjs.FFIDOrganizationSwitcher; }
50
+ get: function () { return chunkC254ATU6_cjs.FFIDOrganizationSwitcher; }
51
51
  });
52
52
  Object.defineProperty(exports, "FFIDProvider", {
53
53
  enumerable: true,
54
- get: function () { return chunkLILTOMJP_cjs.FFIDProvider; }
54
+ get: function () { return chunkC254ATU6_cjs.FFIDProvider; }
55
55
  });
56
56
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
57
57
  enumerable: true,
58
- get: function () { return chunkLILTOMJP_cjs.FFIDSubscriptionBadge; }
58
+ get: function () { return chunkC254ATU6_cjs.FFIDSubscriptionBadge; }
59
59
  });
60
60
  Object.defineProperty(exports, "FFIDUserMenu", {
61
61
  enumerable: true,
62
- get: function () { return chunkLILTOMJP_cjs.FFIDUserMenu; }
62
+ get: function () { return chunkC254ATU6_cjs.FFIDUserMenu; }
63
63
  });
64
64
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
65
65
  enumerable: true,
66
- get: function () { return chunkLILTOMJP_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
66
+ get: function () { return chunkC254ATU6_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
67
67
  });
68
68
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
69
69
  enumerable: true,
70
- get: function () { return chunkLILTOMJP_cjs.createFFIDAnnouncementsClient; }
70
+ get: function () { return chunkC254ATU6_cjs.createFFIDAnnouncementsClient; }
71
71
  });
72
72
  Object.defineProperty(exports, "createFFIDClient", {
73
73
  enumerable: true,
74
- get: function () { return chunkLILTOMJP_cjs.createFFIDClient; }
74
+ get: function () { return chunkC254ATU6_cjs.createFFIDClient; }
75
75
  });
76
76
  Object.defineProperty(exports, "createTokenStore", {
77
77
  enumerable: true,
78
- get: function () { return chunkLILTOMJP_cjs.createTokenStore; }
78
+ get: function () { return chunkC254ATU6_cjs.createTokenStore; }
79
79
  });
80
80
  Object.defineProperty(exports, "generateCodeChallenge", {
81
81
  enumerable: true,
82
- get: function () { return chunkLILTOMJP_cjs.generateCodeChallenge; }
82
+ get: function () { return chunkC254ATU6_cjs.generateCodeChallenge; }
83
83
  });
84
84
  Object.defineProperty(exports, "generateCodeVerifier", {
85
85
  enumerable: true,
86
- get: function () { return chunkLILTOMJP_cjs.generateCodeVerifier; }
86
+ get: function () { return chunkC254ATU6_cjs.generateCodeVerifier; }
87
87
  });
88
88
  Object.defineProperty(exports, "retrieveCodeVerifier", {
89
89
  enumerable: true,
90
- get: function () { return chunkLILTOMJP_cjs.retrieveCodeVerifier; }
90
+ get: function () { return chunkC254ATU6_cjs.retrieveCodeVerifier; }
91
91
  });
92
92
  Object.defineProperty(exports, "storeCodeVerifier", {
93
93
  enumerable: true,
94
- get: function () { return chunkLILTOMJP_cjs.storeCodeVerifier; }
94
+ get: function () { return chunkC254ATU6_cjs.storeCodeVerifier; }
95
95
  });
96
96
  Object.defineProperty(exports, "useFFID", {
97
97
  enumerable: true,
98
- get: function () { return chunkLILTOMJP_cjs.useFFID; }
98
+ get: function () { return chunkC254ATU6_cjs.useFFID; }
99
99
  });
100
100
  Object.defineProperty(exports, "useFFIDAnnouncements", {
101
101
  enumerable: true,
102
- get: function () { return chunkLILTOMJP_cjs.useFFIDAnnouncements; }
102
+ get: function () { return chunkC254ATU6_cjs.useFFIDAnnouncements; }
103
103
  });
104
104
  Object.defineProperty(exports, "useSubscription", {
105
105
  enumerable: true,
106
- get: function () { return chunkLILTOMJP_cjs.useSubscription; }
106
+ get: function () { return chunkC254ATU6_cjs.useSubscription; }
107
107
  });
108
108
  Object.defineProperty(exports, "withSubscription", {
109
109
  enumerable: true,
110
- get: function () { return chunkLILTOMJP_cjs.withSubscription; }
110
+ get: function () { return chunkC254ATU6_cjs.withSubscription; }
111
111
  });
112
112
  exports.withFFIDAuth = withFFIDAuth;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext } from './chunk-4LSSBFZG.js';
2
- export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-4LSSBFZG.js';
1
+ import { useFFIDContext } from './chunk-Q5XWUQHV.js';
2
+ export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-Q5XWUQHV.js';
3
3
  import { useRef, useEffect } from 'react';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",