@feelflow/ffid-sdk 1.1.0 → 1.1.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.
|
@@ -324,7 +324,24 @@ function createFFIDClient(config) {
|
|
|
324
324
|
if (authMode === "token") {
|
|
325
325
|
return getSessionFromUserinfo();
|
|
326
326
|
}
|
|
327
|
-
|
|
327
|
+
const result = await fetchWithAuth(SESSION_ENDPOINT);
|
|
328
|
+
if (result.data?.user) {
|
|
329
|
+
return {
|
|
330
|
+
...result,
|
|
331
|
+
data: {
|
|
332
|
+
...result.data,
|
|
333
|
+
user: normalizeFFIDUser(result.data.user)
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
return result;
|
|
338
|
+
}
|
|
339
|
+
function normalizeFFIDUser(user) {
|
|
340
|
+
return {
|
|
341
|
+
...user,
|
|
342
|
+
locale: user.locale ?? null,
|
|
343
|
+
timezone: user.timezone ?? null
|
|
344
|
+
};
|
|
328
345
|
}
|
|
329
346
|
async function getSessionFromUserinfo() {
|
|
330
347
|
const tokens = tokenStore.getTokens();
|
|
@@ -322,7 +322,24 @@ function createFFIDClient(config) {
|
|
|
322
322
|
if (authMode === "token") {
|
|
323
323
|
return getSessionFromUserinfo();
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
const result = await fetchWithAuth(SESSION_ENDPOINT);
|
|
326
|
+
if (result.data?.user) {
|
|
327
|
+
return {
|
|
328
|
+
...result,
|
|
329
|
+
data: {
|
|
330
|
+
...result.data,
|
|
331
|
+
user: normalizeFFIDUser(result.data.user)
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
return result;
|
|
336
|
+
}
|
|
337
|
+
function normalizeFFIDUser(user) {
|
|
338
|
+
return {
|
|
339
|
+
...user,
|
|
340
|
+
locale: user.locale ?? null,
|
|
341
|
+
timezone: user.timezone ?? null
|
|
342
|
+
};
|
|
326
343
|
}
|
|
327
344
|
async function getSessionFromUserinfo() {
|
|
328
345
|
const tokens = tokenStore.getTokens();
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4QMSVP3G_cjs = require('../chunk-4QMSVP3G.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDLoginButton; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDOrganizationSwitcher; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDSubscriptionBadge; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDUserMenu; }
|
|
30
30
|
});
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-
|
|
1
|
+
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-USE5Q2OF.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4QMSVP3G_cjs = require('./chunk-4QMSVP3G.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 } =
|
|
9
|
+
const { isLoading, isAuthenticated, login } = chunk4QMSVP3G_cjs.useFFIDContext();
|
|
10
10
|
const hasRedirected = react.useRef(false);
|
|
11
11
|
react.useEffect(() => {
|
|
12
12
|
if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
|
|
@@ -31,78 +31,78 @@ function withFFIDAuth(Component, options = {}) {
|
|
|
31
31
|
|
|
32
32
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunk4QMSVP3G_cjs.DEFAULT_API_BASE_URL; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDAnnouncementBadge; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDAnnouncementList; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDLoginButton; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDOrganizationSwitcher; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDProvider; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDSubscriptionBadge; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunk4QMSVP3G_cjs.FFIDUserMenu; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunk4QMSVP3G_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunk4QMSVP3G_cjs.createFFIDAnnouncementsClient; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "createTokenStore", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunk4QMSVP3G_cjs.createTokenStore; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunk4QMSVP3G_cjs.generateCodeChallenge; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunk4QMSVP3G_cjs.generateCodeVerifier; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunk4QMSVP3G_cjs.retrieveCodeVerifier; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunk4QMSVP3G_cjs.storeCodeVerifier; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "useFFID", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunk4QMSVP3G_cjs.useFFID; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunk4QMSVP3G_cjs.useFFIDAnnouncements; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "useSubscription", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunk4QMSVP3G_cjs.useSubscription; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "withSubscription", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunk4QMSVP3G_cjs.withSubscription; }
|
|
107
107
|
});
|
|
108
108
|
exports.withFFIDAuth = withFFIDAuth;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useFFIDContext } from './chunk-
|
|
2
|
-
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-
|
|
1
|
+
import { useFFIDContext } from './chunk-USE5Q2OF.js';
|
|
2
|
+
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-USE5Q2OF.js';
|
|
3
3
|
import { useRef, useEffect } from 'react';
|
|
4
4
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|