@oxyhq/services 6.9.22 → 6.9.23
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/lib/commonjs/ui/components/FontLoader.js +101 -26
- package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAuth.js +7 -4
- package/lib/commonjs/ui/hooks/useAuth.js.map +1 -1
- package/lib/commonjs/ui/hooks/useWebSSO.js +9 -7
- package/lib/commonjs/ui/hooks/useWebSSO.js.map +1 -1
- package/lib/module/ui/components/FontLoader.js +101 -25
- package/lib/module/ui/components/FontLoader.js.map +1 -1
- package/lib/module/ui/hooks/useAuth.js +7 -4
- package/lib/module/ui/hooks/useAuth.js.map +1 -1
- package/lib/module/ui/hooks/useWebSSO.js +9 -7
- package/lib/module/ui/hooks/useWebSSO.js.map +1 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +5 -3
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useWebSSO.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FontLoader.d.ts +5 -3
- package/lib/typescript/module/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useWebSSO.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ui/components/FontLoader.tsx +105 -29
- package/src/ui/hooks/useAuth.ts +7 -4
- package/src/ui/hooks/useWebSSO.ts +9 -7
- package/lib/commonjs/assets/assets/fonts/Inter/InterVariable.ttf +0 -0
- package/lib/commonjs/assets/fonts/Inter/InterVariable.ttf +0 -0
- package/lib/module/assets/assets/fonts/Inter/InterVariable.ttf +0 -0
- package/lib/module/assets/fonts/Inter/InterVariable.ttf +0 -0
- package/src/assets/fonts/Inter/InterVariable.ttf +0 -0
|
@@ -9,75 +9,150 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var Font = _interopRequireWildcard(require("expo-font"));
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
-
// Single variable font file that covers all weights (100–900)
|
|
13
|
-
const InterVariable = require('../../assets/fonts/Inter/InterVariable.ttf');
|
|
14
|
-
const WEIGHT_NAMES = ['Light', 'Regular', 'Medium', 'SemiBold', 'Bold', 'ExtraBold', 'Black'];
|
|
15
|
-
|
|
16
12
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
* Get the Inter font sources for both native and web environments
|
|
14
|
+
* This is specifically designed to work when distributed as an npm package
|
|
15
|
+
*/const getInterFonts = () => {
|
|
16
|
+
try {
|
|
17
|
+
// For both development and when used as a package
|
|
18
|
+
// Load all static font weights
|
|
19
|
+
return {
|
|
20
|
+
'Inter-Light': require('../../assets/fonts/Inter/Inter_18pt-Light.ttf'),
|
|
21
|
+
'Inter-Regular': require('../../assets/fonts/Inter/Inter_18pt-Regular.ttf'),
|
|
22
|
+
'Inter-Medium': require('../../assets/fonts/Inter/Inter_18pt-Medium.ttf'),
|
|
23
|
+
'Inter-SemiBold': require('../../assets/fonts/Inter/Inter_18pt-SemiBold.ttf'),
|
|
24
|
+
'Inter-Bold': require('../../assets/fonts/Inter/Inter_18pt-Bold.ttf'),
|
|
25
|
+
'Inter-ExtraBold': require('../../assets/fonts/Inter/Inter_18pt-ExtraBold.ttf'),
|
|
26
|
+
'Inter-Black': require('../../assets/fonts/Inter/Inter_18pt-Black.ttf')
|
|
27
|
+
};
|
|
28
|
+
} catch (error) {
|
|
29
|
+
if (__DEV__) {
|
|
30
|
+
console.warn('Failed to load Inter fonts:', error);
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
26
33
|
}
|
|
27
|
-
return fontMap;
|
|
28
34
|
};
|
|
29
35
|
|
|
30
36
|
/**
|
|
31
|
-
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
32
|
-
*
|
|
37
|
+
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
38
|
+
* This works in both the package development and when consumed as an npm package
|
|
39
|
+
* Children render immediately with system fonts as fallback until custom fonts are loaded
|
|
33
40
|
*/
|
|
34
41
|
const FontLoader = ({
|
|
35
42
|
children
|
|
36
43
|
}) => {
|
|
37
44
|
const [fontState, setFontState] = (0, _react.useState)('loading');
|
|
38
45
|
(0, _react.useEffect)(() => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
const loadFonts = async () => {
|
|
47
|
+
try {
|
|
48
|
+
// Get all the font weights
|
|
49
|
+
const interFonts = getInterFonts();
|
|
50
|
+
if (!interFonts) {
|
|
51
|
+
throw new Error('Inter font files not found');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Load all the static Inter fonts with their respective weights
|
|
55
|
+
await Font.loadAsync(interFonts);
|
|
56
|
+
setFontState('loaded');
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (__DEV__) {
|
|
59
|
+
console.error('Error loading fonts:', error);
|
|
60
|
+
}
|
|
61
|
+
setFontState('error');
|
|
42
62
|
}
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
};
|
|
64
|
+
loadFonts();
|
|
45
65
|
}, []);
|
|
66
|
+
|
|
67
|
+
// Always render children immediately - fonts will load in background
|
|
68
|
+
// If fonts aren't loaded yet, the app will use system fonts as fallback
|
|
46
69
|
if (fontState === 'error' && __DEV__) {
|
|
47
70
|
console.warn('Fonts failed to load. Using system fonts instead.');
|
|
48
71
|
}
|
|
72
|
+
|
|
73
|
+
// Render children immediately, even while fonts are loading
|
|
74
|
+
// Fonts will apply when they're ready, otherwise system fonts are used
|
|
49
75
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
50
76
|
children: children
|
|
51
77
|
});
|
|
52
78
|
};
|
|
53
79
|
|
|
54
80
|
/**
|
|
55
|
-
* Setup fonts for applications consuming this package
|
|
81
|
+
* Setup fonts for applications consuming this package
|
|
82
|
+
* This should be called by applications using your package
|
|
56
83
|
*/
|
|
57
84
|
exports.FontLoader = FontLoader;
|
|
58
85
|
const setupFonts = async () => {
|
|
59
86
|
try {
|
|
60
87
|
const interFonts = getInterFonts();
|
|
88
|
+
if (!interFonts) {
|
|
89
|
+
throw new Error('Inter font files not found');
|
|
90
|
+
}
|
|
61
91
|
if (_reactNative.Platform.OS === 'web') {
|
|
92
|
+
// For web platform, dynamically inject CSS to load the fonts
|
|
62
93
|
if (typeof document !== 'undefined') {
|
|
94
|
+
// Create a style element
|
|
63
95
|
const style = document.createElement('style');
|
|
64
|
-
|
|
96
|
+
|
|
97
|
+
// Define @font-face rules for each font weight
|
|
98
|
+
const fontFaceRules = `
|
|
99
|
+
@font-face {
|
|
100
|
+
font-family: 'Inter';
|
|
101
|
+
src: url(${interFonts['Inter-Light']}) format('truetype');
|
|
102
|
+
font-weight: 300;
|
|
103
|
+
font-style: normal;
|
|
104
|
+
}
|
|
105
|
+
@font-face {
|
|
106
|
+
font-family: 'Inter';
|
|
107
|
+
src: url(${interFonts['Inter-Regular']}) format('truetype');
|
|
108
|
+
font-weight: 400;
|
|
109
|
+
font-style: normal;
|
|
110
|
+
}
|
|
111
|
+
@font-face {
|
|
112
|
+
font-family: 'Inter';
|
|
113
|
+
src: url(${interFonts['Inter-Medium']}) format('truetype');
|
|
114
|
+
font-weight: 500;
|
|
115
|
+
font-style: normal;
|
|
116
|
+
}
|
|
117
|
+
@font-face {
|
|
118
|
+
font-family: 'Inter';
|
|
119
|
+
src: url(${interFonts['Inter-SemiBold']}) format('truetype');
|
|
120
|
+
font-weight: 600;
|
|
121
|
+
font-style: normal;
|
|
122
|
+
}
|
|
123
|
+
@font-face {
|
|
124
|
+
font-family: 'Inter';
|
|
125
|
+
src: url(${interFonts['Inter-Bold']}) format('truetype');
|
|
126
|
+
font-weight: 700;
|
|
127
|
+
font-style: normal;
|
|
128
|
+
}
|
|
129
|
+
@font-face {
|
|
130
|
+
font-family: 'Inter';
|
|
131
|
+
src: url(${interFonts['Inter-ExtraBold']}) format('truetype');
|
|
132
|
+
font-weight: 800;
|
|
133
|
+
font-style: normal;
|
|
134
|
+
}
|
|
65
135
|
@font-face {
|
|
66
136
|
font-family: 'Inter';
|
|
67
|
-
src: url(${
|
|
68
|
-
font-weight:
|
|
137
|
+
src: url(${interFonts['Inter-Black']}) format('truetype');
|
|
138
|
+
font-weight: 900;
|
|
69
139
|
font-style: normal;
|
|
70
140
|
}
|
|
71
141
|
`;
|
|
142
|
+
style.textContent = fontFaceRules;
|
|
72
143
|
document.head.appendChild(style);
|
|
144
|
+
if (__DEV__) {
|
|
145
|
+
console.info('All Inter web fonts have been dynamically loaded');
|
|
146
|
+
}
|
|
73
147
|
}
|
|
74
148
|
} else {
|
|
149
|
+
// Attempt to load the fonts anyway (this works if the consumer has linked the assets)
|
|
75
150
|
await Font.loadAsync(interFonts);
|
|
76
151
|
}
|
|
77
152
|
return true;
|
|
78
153
|
} catch (error) {
|
|
79
154
|
if (__DEV__) {
|
|
80
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
155
|
+
const errorMessage = error instanceof Error ? error instanceof Error ? error.message : null : String(error);
|
|
81
156
|
console.warn('Error setting up fonts:', errorMessage);
|
|
82
157
|
}
|
|
83
158
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","Font","_interopRequireWildcard","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","Font","_interopRequireWildcard","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getInterFonts","error","__DEV__","console","warn","FontLoader","children","fontState","setFontState","useState","useEffect","loadFonts","interFonts","Error","loadAsync","jsx","Fragment","exports","setupFonts","Platform","OS","document","style","createElement","fontFaceRules","textContent","head","appendChild","info","errorMessage","message","String"],"sourceRoot":"../../../../src","sources":["ui/components/FontLoader.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAC,uBAAA,CAAAH,OAAA;AAAkC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAG,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAA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ACA;AACA;AACA;AACA,mCAAmCA,UAAU,CAAC,eAAe,CAAC;AAC9D;AACA;AACA;AACA;AACA;AACA,mCAAmCA,UAAU,CAAC,cAAc,CAAC;AAC7D;AACA;AACA;AACA;AACA;AACA,mCAAmCA,UAAU,CAAC,gBAAgB,CAAC;AAC/D;AACA;AACA;AACA;AACA;AACA,mCAAmCA,UAAU,CAAC,YAAY,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA,mCAAmCA,UAAU,CAAC,iBAAiB,CAAC;AAChE;AACA;AACA;AACA;AACA;AACA,mCAAmCA,UAAU,CAAC,aAAa,CAAC;AAC5D;AACA;AACA;AACA,iBAAiB;QAEDU,KAAK,CAACG,WAAW,GAAGD,aAAa;QACjCH,QAAQ,CAACK,IAAI,CAACC,WAAW,CAACL,KAAK,CAAC;QAChC,IAAIpB,OAAO,EAAE;UACbC,OAAO,CAACyB,IAAI,CAAC,kDAAkD,CAAC;QAChE;MACJ;IACJ,CAAC,MAAM;MACH;MACA,MAAMlD,IAAI,CAACoC,SAAS,CAACF,UAAU,CAAC;IACpC;IAEA,OAAO,IAAI;EACf,CAAC,CAAC,OAAOX,KAAc,EAAE;IACrB,IAAIC,OAAO,EAAE;MACb,MAAM2B,YAAY,GAAG5B,KAAK,YAAYY,KAAK,GAAIZ,KAAK,YAAYY,KAAK,GAAGZ,KAAK,CAAC6B,OAAO,GAAG,IAAI,GAAIC,MAAM,CAAC9B,KAAK,CAAC;MAC7GE,OAAO,CAACC,IAAI,CAAC,yBAAyB,EAAEyB,YAAY,CAAC;IACrD;IACA,OAAO,KAAK;EAChB;AACJ,CAAC;AAACZ,OAAA,CAAAC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -66,9 +66,11 @@ function useAuth() {
|
|
|
66
66
|
openAvatarPicker
|
|
67
67
|
} = (0, _OxyContext.useOxy)();
|
|
68
68
|
const signIn = (0, _react.useCallback)(async publicKey => {
|
|
69
|
-
// Check if we're on the identity provider itself
|
|
70
|
-
// Only
|
|
71
|
-
const
|
|
69
|
+
// Check if we're on the identity provider itself
|
|
70
|
+
// Only the IdP has local login forms - other apps are client apps
|
|
71
|
+
const authWebUrl = oxyServices.config?.authWebUrl;
|
|
72
|
+
const idpHostname = authWebUrl ? new URL(authWebUrl).hostname : 'auth.oxy.so';
|
|
73
|
+
const isIdentityProvider = (0, _useWebSSO.isWebBrowser)() && window.location.hostname === idpHostname;
|
|
72
74
|
|
|
73
75
|
// Web (not on IdP): Use popup-based authentication
|
|
74
76
|
// We go straight to popup to preserve the "user gesture" (click event)
|
|
@@ -123,7 +125,8 @@ function useAuth() {
|
|
|
123
125
|
|
|
124
126
|
// Web fallback: navigate to login page on auth domain
|
|
125
127
|
if ((0, _useWebSSO.isWebBrowser)()) {
|
|
126
|
-
const
|
|
128
|
+
const authBase = authWebUrl || 'https://accounts.oxy.so';
|
|
129
|
+
const loginUrl = window.location.hostname.includes('oxy.so') ? '/login' : `${authBase}/login`;
|
|
127
130
|
window.location.href = loginUrl;
|
|
128
131
|
return new Promise(() => {}); // Never resolves, page will redirect
|
|
129
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_OxyContext","_useWebSSO","useAuth","user","isAuthenticated","isLoading","isTokenReady","error","signIn","oxySignIn","handlePopupSession","logout","logoutAll","refreshSessions","oxyServices","hasIdentity","getPublicKey","showBottomSheet","openAvatarPicker","useOxy","useCallback","publicKey","isIdentityProvider","isWebBrowser","window","location","
|
|
1
|
+
{"version":3,"names":["_react","require","_OxyContext","_useWebSSO","useAuth","user","isAuthenticated","isLoading","isTokenReady","error","signIn","oxySignIn","handlePopupSession","logout","logoutAll","refreshSessions","oxyServices","hasIdentity","getPublicKey","showBottomSheet","openAvatarPicker","useOxy","useCallback","publicKey","authWebUrl","config","idpHostname","URL","hostname","isIdentityProvider","isWebBrowser","window","location","popupSession","signInWithPopup","sessionWithUser","Error","popupError","message","includes","hasExisting","existingKey","Promise","_","reject","authBase","loginUrl","href","signOut","signOutAll","refresh","isReady"],"sourceRoot":"../../../../src","sources":["ui/hooks/useAuth.ts"],"mappings":";;;;;;;;;;;;AAyBA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AA5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,OAAOA,CAAA,EAAkB;EACvC,MAAM;IACJC,IAAI;IACJC,eAAe;IACfC,SAAS;IACTC,YAAY;IACZC,KAAK;IACLC,MAAM,EAAEC,SAAS;IACjBC,kBAAkB;IAClBC,MAAM;IACNC,SAAS;IACTC,eAAe;IACfC,WAAW;IACXC,WAAW;IACXC,YAAY;IACZC,eAAe;IACfC;EACF,CAAC,GAAG,IAAAC,kBAAM,EAAC,CAAC;EAEZ,MAAMX,MAAM,GAAG,IAAAY,kBAAW,EAAC,MAAOC,SAAkB,IAAoB;IACtE;IACA;IACA,MAAMC,UAAU,GAAGR,WAAW,CAACS,MAAM,EAAED,UAAU;IACjD,MAAME,WAAW,GAAGF,UAAU,GAAG,IAAIG,GAAG,CAACH,UAAU,CAAC,CAACI,QAAQ,GAAG,aAAa;IAC7E,MAAMC,kBAAkB,GAAG,IAAAC,uBAAY,EAAC,CAAC,IACvCC,MAAM,CAACC,QAAQ,CAACJ,QAAQ,KAAKF,WAAW;;IAE1C;IACA;IACA;IACA;IACA,IAAI,IAAAI,uBAAY,EAAC,CAAC,IAAI,CAACP,SAAS,IAAI,CAACM,kBAAkB,EAAE;MACvD,IAAI;QACF,MAAMI,YAAY,GAAG,MAAMjB,WAAW,CAACkB,eAAe,GAAG,CAAC;QAC1D,IAAID,YAAY,EAAE5B,IAAI,EAAE;UACtB;UACA;UACA;UACA,MAAM8B,eAAe,GAAG;YACtB,GAA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M,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC;IAEA,MAAM,IAAIN,KAAK,CAAC,oCAAoC,CAAC;EACvD,CAAC,EAAE,CAACzB,SAAS,EAAEM,WAAW,EAAEC,YAAY,EAAEC,eAAe,EAAEH,WAAW,EAAEJ,kBAAkB,CAAC,CAAC;EAE5F,MAAMoC,OAAO,GAAG,IAAA1B,kBAAW,EAAC,YAA2B;IACrD,MAAMT,MAAM,CAAC,CAAC;EAChB,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZ,MAAMoC,UAAU,GAAG,IAAA3B,kBAAW,EAAC,YAA2B;IACxD,MAAMR,SAAS,CAAC,CAAC;EACnB,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;EAEf,MAAMoC,OAAO,GAAG,IAAA5B,kBAAW,EAAC,YAA2B;IACrD,MAAMP,eAAe,CAAC,CAAC;EACzB,CAAC,EAAE,CAACA,eAAe,CAAC,CAAC;EAErB,OAAO;IACL;IACAV,IAAI;IACJC,eAAe;IACfC,SAAS;IACT4C,OAAO,EAAE3C,YAAY;IACrBC,KAAK;IAEL;IACAC,MAAM;IACNsC,OAAO;IACPC,UAAU;IACVC,OAAO;IAEP;IACAlC,WAAW;IACXG,eAAe;IACfC;EACF,CAAC;AACH;;AAEA","ignoreList":[]}
|
|
@@ -32,12 +32,13 @@ function isWebBrowser() {
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Check if we're on the identity provider domain (where FedCM would authenticate against itself)
|
|
35
|
-
*
|
|
35
|
+
* Compares against config.authWebUrl if set, otherwise defaults to auth.oxy.so
|
|
36
36
|
*/
|
|
37
|
-
function isIdentityProvider() {
|
|
37
|
+
function isIdentityProvider(authWebUrl) {
|
|
38
38
|
if (!isWebBrowser()) return false;
|
|
39
39
|
const hostname = window.location.hostname;
|
|
40
|
-
|
|
40
|
+
const idpHostname = authWebUrl ? new URL(authWebUrl).hostname : 'auth.oxy.so';
|
|
41
|
+
return hostname === idpHostname;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/**
|
|
@@ -68,13 +69,14 @@ function useWebSSO({
|
|
|
68
69
|
|
|
69
70
|
// Check FedCM support once
|
|
70
71
|
const fedCMSupported = isWebBrowser() && oxyServices.isFedCMSupported?.();
|
|
72
|
+
const authWebUrl = oxyServices.config?.authWebUrl;
|
|
71
73
|
const checkSSO = (0, _react.useCallback)(async () => {
|
|
72
74
|
if (!isWebBrowser() || isCheckingRef.current) {
|
|
73
75
|
return null;
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
// Don't use FedCM on the auth domain itself - it would authenticate against itself
|
|
77
|
-
if (isIdentityProvider()) {
|
|
79
|
+
if (isIdentityProvider(authWebUrl)) {
|
|
78
80
|
onSSOUnavailable?.();
|
|
79
81
|
return null;
|
|
80
82
|
}
|
|
@@ -100,7 +102,7 @@ function useWebSSO({
|
|
|
100
102
|
} finally {
|
|
101
103
|
isCheckingRef.current = false;
|
|
102
104
|
}
|
|
103
|
-
}, [oxyServices, onSessionFound, onSSOUnavailable, onError, fedCMSupported]);
|
|
105
|
+
}, [oxyServices, onSessionFound, onSSOUnavailable, onError, fedCMSupported, authWebUrl]);
|
|
104
106
|
|
|
105
107
|
/**
|
|
106
108
|
* Trigger interactive FedCM sign-in
|
|
@@ -133,8 +135,8 @@ function useWebSSO({
|
|
|
133
135
|
|
|
134
136
|
// Auto-check SSO on mount (web only, FedCM only, not on auth domain)
|
|
135
137
|
(0, _react.useEffect)(() => {
|
|
136
|
-
if (!enabled || !isWebBrowser() || hasCheckedRef.current || isIdentityProvider()) {
|
|
137
|
-
if (isIdentityProvider()) {
|
|
138
|
+
if (!enabled || !isWebBrowser() || hasCheckedRef.current || isIdentityProvider(authWebUrl)) {
|
|
139
|
+
if (isIdentityProvider(authWebUrl)) {
|
|
138
140
|
onSSOUnavailable?.();
|
|
139
141
|
}
|
|
140
142
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","isWebBrowser","window","document","documentElement","isIdentityProvider","hostname","location","useWebSSO","oxyServices","onSessionFound","onSSOUnavailable","onError","enabled","isCheckingRef","useRef","hasCheckedRef","fedCMSupported","isFedCMSupported","checkSSO","useCallback","current","session","silentSignInWithFedCM","error","Error","String","signInWithFedCM","useEffect","isChecking"],"sourceRoot":"../../../../src","sources":["ui/hooks/useWebSSO.ts"],"mappings":";;;;;;;AAiBA,IAAAA,MAAA,GAAAC,OAAA;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyBA;AACA;AACA;AACA,SAASC,YAAYA,CAAA,EAAY;EAC/B,OAAO,OAAOC,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK,WAAW,IAC/B,OAAOA,QAAQ,CAACC,eAAe,KAAK,WAAW;AACxD;;AAEA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,
|
|
1
|
+
{"version":3,"names":["_react","require","isWebBrowser","window","document","documentElement","isIdentityProvider","authWebUrl","hostname","location","idpHostname","URL","useWebSSO","oxyServices","onSessionFound","onSSOUnavailable","onError","enabled","isCheckingRef","useRef","hasCheckedRef","fedCMSupported","isFedCMSupported","config","checkSSO","useCallback","current","session","silentSignInWithFedCM","error","Error","String","signInWithFedCM","useEffect","isChecking"],"sourceRoot":"../../../../src","sources":["ui/hooks/useWebSSO.ts"],"mappings":";;;;;;;AAiBA,IAAAA,MAAA,GAAAC,OAAA;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyBA;AACA;AACA;AACA,SAASC,YAAYA,CAAA,EAAY;EAC/B,OAAO,OAAOC,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK,WAAW,IAC/B,OAAOA,QAAQ,CAACC,eAAe,KAAK,WAAW;AACxD;;AAEA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAACC,UAAmB,EAAW;EACxD,IAAI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,CAAC;;EAE1D;EACA,IAAAY,gBAAS,EAAC,MAAM;IACd,IAAI,CAAChB,OAAO,IAAI,CAACf,YAAY,CAAC,CAAC,IAAIkB,aAAa,CAACM,OAAO,IAAIpB,kBAAkB,CAACC,UAAU,CAAC,EAAE;MAC1F,IAAID,kBAAkB,CAACC,UAAU,CAAC,EAAE;QAClCQ,gBAAgB,GAAG,CAAC;MACtB;MACA;IACF;IAEAK,aAAa,CAACM,OAAO,GAAG,IAAI;IAE5B,IAAIL,cAAc,EAAE;MAClBG,QAAQ,CAAC,CAAC;IACZ,CAAC,MAAM;MACLT,gBAAgB,GAAG,CAAC;IACtB;EACF,CAAC,EAAE,CAACE,OAAO,EAAEO,QAAQ,EAAEH,cAAc,EAAEN,gBAAgB,CAAC,CAAC;EAEzD,OAAO;IACLS,QAAQ;IACRQ,eAAe;IACfE,UAAU,EAAEhB,aAAa,CAACQ,OAAO;IACjCJ,gBAAgB,EAAED;EACpB,CAAC;AACH","ignoreList":[]}
|
|
@@ -4,75 +4,151 @@ import { useState, useEffect } from 'react';
|
|
|
4
4
|
import { Platform } from 'react-native';
|
|
5
5
|
import * as Font from 'expo-font';
|
|
6
6
|
|
|
7
|
-
// Single variable font file that covers all weights (100–900)
|
|
8
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const InterVariable = require('../../assets/fonts/Inter/InterVariable.ttf');
|
|
10
|
-
const WEIGHT_NAMES = ['Light', 'Regular', 'Medium', 'SemiBold', 'Bold', 'ExtraBold', 'Black'];
|
|
11
|
-
|
|
12
7
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* per alias (e.g. Inter-Regular, Inter-Bold) to keep fontFamily references working.
|
|
8
|
+
* Get the Inter font sources for both native and web environments
|
|
9
|
+
* This is specifically designed to work when distributed as an npm package
|
|
16
10
|
*/
|
|
11
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
17
12
|
const getInterFonts = () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
try {
|
|
14
|
+
// For both development and when used as a package
|
|
15
|
+
// Load all static font weights
|
|
16
|
+
return {
|
|
17
|
+
'Inter-Light': require('../../assets/fonts/Inter/Inter_18pt-Light.ttf'),
|
|
18
|
+
'Inter-Regular': require('../../assets/fonts/Inter/Inter_18pt-Regular.ttf'),
|
|
19
|
+
'Inter-Medium': require('../../assets/fonts/Inter/Inter_18pt-Medium.ttf'),
|
|
20
|
+
'Inter-SemiBold': require('../../assets/fonts/Inter/Inter_18pt-SemiBold.ttf'),
|
|
21
|
+
'Inter-Bold': require('../../assets/fonts/Inter/Inter_18pt-Bold.ttf'),
|
|
22
|
+
'Inter-ExtraBold': require('../../assets/fonts/Inter/Inter_18pt-ExtraBold.ttf'),
|
|
23
|
+
'Inter-Black': require('../../assets/fonts/Inter/Inter_18pt-Black.ttf')
|
|
24
|
+
};
|
|
25
|
+
} catch (error) {
|
|
26
|
+
if (__DEV__) {
|
|
27
|
+
console.warn('Failed to load Inter fonts:', error);
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
22
30
|
}
|
|
23
|
-
return fontMap;
|
|
24
31
|
};
|
|
25
32
|
|
|
26
33
|
/**
|
|
27
|
-
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
28
|
-
*
|
|
34
|
+
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
35
|
+
* This works in both the package development and when consumed as an npm package
|
|
36
|
+
* Children render immediately with system fonts as fallback until custom fonts are loaded
|
|
29
37
|
*/
|
|
30
38
|
export const FontLoader = ({
|
|
31
39
|
children
|
|
32
40
|
}) => {
|
|
33
41
|
const [fontState, setFontState] = useState('loading');
|
|
34
42
|
useEffect(() => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
const loadFonts = async () => {
|
|
44
|
+
try {
|
|
45
|
+
// Get all the font weights
|
|
46
|
+
const interFonts = getInterFonts();
|
|
47
|
+
if (!interFonts) {
|
|
48
|
+
throw new Error('Inter font files not found');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Load all the static Inter fonts with their respective weights
|
|
52
|
+
await Font.loadAsync(interFonts);
|
|
53
|
+
setFontState('loaded');
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (__DEV__) {
|
|
56
|
+
console.error('Error loading fonts:', error);
|
|
57
|
+
}
|
|
58
|
+
setFontState('error');
|
|
38
59
|
}
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
};
|
|
61
|
+
loadFonts();
|
|
41
62
|
}, []);
|
|
63
|
+
|
|
64
|
+
// Always render children immediately - fonts will load in background
|
|
65
|
+
// If fonts aren't loaded yet, the app will use system fonts as fallback
|
|
42
66
|
if (fontState === 'error' && __DEV__) {
|
|
43
67
|
console.warn('Fonts failed to load. Using system fonts instead.');
|
|
44
68
|
}
|
|
69
|
+
|
|
70
|
+
// Render children immediately, even while fonts are loading
|
|
71
|
+
// Fonts will apply when they're ready, otherwise system fonts are used
|
|
45
72
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
46
73
|
children: children
|
|
47
74
|
});
|
|
48
75
|
};
|
|
49
76
|
|
|
50
77
|
/**
|
|
51
|
-
* Setup fonts for applications consuming this package
|
|
78
|
+
* Setup fonts for applications consuming this package
|
|
79
|
+
* This should be called by applications using your package
|
|
52
80
|
*/
|
|
53
81
|
export const setupFonts = async () => {
|
|
54
82
|
try {
|
|
55
83
|
const interFonts = getInterFonts();
|
|
84
|
+
if (!interFonts) {
|
|
85
|
+
throw new Error('Inter font files not found');
|
|
86
|
+
}
|
|
56
87
|
if (Platform.OS === 'web') {
|
|
88
|
+
// For web platform, dynamically inject CSS to load the fonts
|
|
57
89
|
if (typeof document !== 'undefined') {
|
|
90
|
+
// Create a style element
|
|
58
91
|
const style = document.createElement('style');
|
|
59
|
-
|
|
92
|
+
|
|
93
|
+
// Define @font-face rules for each font weight
|
|
94
|
+
const fontFaceRules = `
|
|
95
|
+
@font-face {
|
|
96
|
+
font-family: 'Inter';
|
|
97
|
+
src: url(${interFonts['Inter-Light']}) format('truetype');
|
|
98
|
+
font-weight: 300;
|
|
99
|
+
font-style: normal;
|
|
100
|
+
}
|
|
101
|
+
@font-face {
|
|
102
|
+
font-family: 'Inter';
|
|
103
|
+
src: url(${interFonts['Inter-Regular']}) format('truetype');
|
|
104
|
+
font-weight: 400;
|
|
105
|
+
font-style: normal;
|
|
106
|
+
}
|
|
107
|
+
@font-face {
|
|
108
|
+
font-family: 'Inter';
|
|
109
|
+
src: url(${interFonts['Inter-Medium']}) format('truetype');
|
|
110
|
+
font-weight: 500;
|
|
111
|
+
font-style: normal;
|
|
112
|
+
}
|
|
113
|
+
@font-face {
|
|
114
|
+
font-family: 'Inter';
|
|
115
|
+
src: url(${interFonts['Inter-SemiBold']}) format('truetype');
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
font-style: normal;
|
|
118
|
+
}
|
|
119
|
+
@font-face {
|
|
120
|
+
font-family: 'Inter';
|
|
121
|
+
src: url(${interFonts['Inter-Bold']}) format('truetype');
|
|
122
|
+
font-weight: 700;
|
|
123
|
+
font-style: normal;
|
|
124
|
+
}
|
|
125
|
+
@font-face {
|
|
126
|
+
font-family: 'Inter';
|
|
127
|
+
src: url(${interFonts['Inter-ExtraBold']}) format('truetype');
|
|
128
|
+
font-weight: 800;
|
|
129
|
+
font-style: normal;
|
|
130
|
+
}
|
|
60
131
|
@font-face {
|
|
61
132
|
font-family: 'Inter';
|
|
62
|
-
src: url(${
|
|
63
|
-
font-weight:
|
|
133
|
+
src: url(${interFonts['Inter-Black']}) format('truetype');
|
|
134
|
+
font-weight: 900;
|
|
64
135
|
font-style: normal;
|
|
65
136
|
}
|
|
66
137
|
`;
|
|
138
|
+
style.textContent = fontFaceRules;
|
|
67
139
|
document.head.appendChild(style);
|
|
140
|
+
if (__DEV__) {
|
|
141
|
+
console.info('All Inter web fonts have been dynamically loaded');
|
|
142
|
+
}
|
|
68
143
|
}
|
|
69
144
|
} else {
|
|
145
|
+
// Attempt to load the fonts anyway (this works if the consumer has linked the assets)
|
|
70
146
|
await Font.loadAsync(interFonts);
|
|
71
147
|
}
|
|
72
148
|
return true;
|
|
73
149
|
} catch (error) {
|
|
74
150
|
if (__DEV__) {
|
|
75
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
151
|
+
const errorMessage = error instanceof Error ? error instanceof Error ? error.message : null : String(error);
|
|
76
152
|
console.warn('Error setting up fonts:', errorMessage);
|
|
77
153
|
}
|
|
78
154
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useState","useEffect","Platform","Font","Fragment","_Fragment","jsx","_jsx","
|
|
1
|
+
{"version":3,"names":["useState","useEffect","Platform","Font","Fragment","_Fragment","jsx","_jsx","getInterFonts","require","error","__DEV__","console","warn","FontLoader","children","fontState","setFontState","loadFonts","interFonts","Error","loadAsync","setupFonts","OS","document","style","createElement","fontFaceRules","textContent","head","appendChild","info","errorMessage","message","String"],"sourceRoot":"../../../../src","sources":["ui/components/FontLoader.tsx"],"mappings":";;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC3C,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAO,KAAKC,IAAI,MAAM,WAAW;;AAEjC;AACA;AACA;AACA;AAHA,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAIA,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACxB,IAAI;IACA;IACA;IACA,OAAO;MACH,aAAa,EAAEC,OAAO,CAAC,+CAA+C,CAAC;MACvE,eAAe,EAAEA,OAAO,CAAC,iDAAiD,CAAC;MAC3E,cAAc,EAAEA,OAAO,CAAC,gDAAgD,CAAC;MACzE,gBAAgB,EAAEA,OAAO,CAAC,kDAAkD,CAAC;MAC7E,YAAY,EAAEA,OAAO,CAAC,8CAA8C,CAAC;MACrE,iBAAiB,EAAEA,OAAO,CAAC,mDAAmD,CAAC;MAC/E,a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,KAAK,CAAC;MAC7GE,OAAO,CAACC,IAAI,CAAC,yBAAyB,EAAEmB,YAAY,CAAC;IACrD;IACA,OAAO,KAAK;EAChB;AACJ,CAAC","ignoreList":[]}
|
|
@@ -56,9 +56,11 @@ export function useAuth() {
|
|
|
56
56
|
openAvatarPicker
|
|
57
57
|
} = useOxy();
|
|
58
58
|
const signIn = useCallback(async publicKey => {
|
|
59
|
-
// Check if we're on the identity provider itself
|
|
60
|
-
// Only
|
|
61
|
-
const
|
|
59
|
+
// Check if we're on the identity provider itself
|
|
60
|
+
// Only the IdP has local login forms - other apps are client apps
|
|
61
|
+
const authWebUrl = oxyServices.config?.authWebUrl;
|
|
62
|
+
const idpHostname = authWebUrl ? new URL(authWebUrl).hostname : 'auth.oxy.so';
|
|
63
|
+
const isIdentityProvider = isWebBrowser() && window.location.hostname === idpHostname;
|
|
62
64
|
|
|
63
65
|
// Web (not on IdP): Use popup-based authentication
|
|
64
66
|
// We go straight to popup to preserve the "user gesture" (click event)
|
|
@@ -113,7 +115,8 @@ export function useAuth() {
|
|
|
113
115
|
|
|
114
116
|
// Web fallback: navigate to login page on auth domain
|
|
115
117
|
if (isWebBrowser()) {
|
|
116
|
-
const
|
|
118
|
+
const authBase = authWebUrl || 'https://accounts.oxy.so';
|
|
119
|
+
const loginUrl = window.location.hostname.includes('oxy.so') ? '/login' : `${authBase}/login`;
|
|
117
120
|
window.location.href = loginUrl;
|
|
118
121
|
return new Promise(() => {}); // Never resolves, page will redirect
|
|
119
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useOxy","isWebBrowser","useAuth","user","isAuthenticated","isLoading","isTokenReady","error","signIn","oxySignIn","handlePopupSession","logout","logoutAll","refreshSessions","oxyServices","hasIdentity","getPublicKey","showBottomSheet","openAvatarPicker","publicKey","
|
|
1
|
+
{"version":3,"names":["useCallback","useOxy","isWebBrowser","useAuth","user","isAuthenticated","isLoading","isTokenReady","error","signIn","oxySignIn","handlePopupSession","logout","logoutAll","refreshSessions","oxyServices","hasIdentity","getPublicKey","showBottomSheet","openAvatarPicker","publicKey","authWebUrl","config","idpHostname","URL","hostname","isIdentityProvider","window","location","popupSession","signInWithPopup","sessionWithUser","Error","popupError","message","includes","hasExisting","existingKey","Promise","_","reject","authBase","loginUrl","href","signOut","signOutAll","refresh","isReady"],"sourceRoot":"../../../../src","sources":["ui/hooks/useAuth.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAkB,OAAO;AAC7C,SAASC,MAAM,QAAQ,0BAAuB;AAE9C,SAASC,YAAY,QAAQ,gBAAa;AAoD1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAAA,EAAkB;EACvC,MAAM;IACJC,IAAI;IACJC,eAAe;IACfC,SAAS;IACTC,YAAY;IACZC,KAAK;IACLC,MAAM,EAAEC,SAAS;IACjBC,kBAAkB;IAClBC,MAAM;IACNC,SAAS;IACTC,eAAe;IACfC,WAAW;IACXC,WAAW;IACXC,YAAY;IACZC,eAAe;IACfC;EACF,CAAC,GAAGlB,MAAM,CAAC,CAAC;EAEZ,MAAMQ,MAAM,GAAGT,WAAW,CAAC,MAAOoB,SAAkB,IAAoB;IACtE;IACA;IACA,MAAMC,UAAU,GAAGN,WAAW,CAACO,MAAM,EAAED,UAAU;IACjD,MAAME,WAAW,GAAGF,UAAU,GAAG,IAAIG,GAAG,CAACH,UAAU,CAAC,CAACI,QAAQ,GAAG,aAAa;IAC7E,MAAMC,kBAAkB,GAAGxB,YAAY,CAAC,CAAC,IACvCyB,MAAM,CAACC,QAAQ,CAACH,QAAQ,KAAKF,WAAW;;IAE1C;IACA;IACA;IACA;IACA,IAAIrB,YAAY,CAAC,CAAC,IAAI,CAACkB,SAAS,IAAI,CAACM,kBAAkB,E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AACU,QAAQ,CAAC,QAAQ,CAAC,GACxD,QAAQ,GACR,GAAGM,QAAQ,QAAQ;MACvBd,MAAM,CAACC,QAAQ,CAACe,IAAI,GAAGD,QAAQ;MAC/B,OAAO,IAAIJ,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC;IAEA,MAAM,IAAIN,KAAK,CAAC,oCAAoC,CAAC;EACvD,CAAC,EAAE,CAACtB,SAAS,EAAEM,WAAW,EAAEC,YAAY,EAAEC,eAAe,EAAEH,WAAW,EAAEJ,kBAAkB,CAAC,CAAC;EAE5F,MAAMiC,OAAO,GAAG5C,WAAW,CAAC,YAA2B;IACrD,MAAMY,MAAM,CAAC,CAAC;EAChB,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZ,MAAMiC,UAAU,GAAG7C,WAAW,CAAC,YAA2B;IACxD,MAAMa,SAAS,CAAC,CAAC;EACnB,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;EAEf,MAAMiC,OAAO,GAAG9C,WAAW,CAAC,YAA2B;IACrD,MAAMc,eAAe,CAAC,CAAC;EACzB,CAAC,EAAE,CAACA,eAAe,CAAC,CAAC;EAErB,OAAO;IACL;IACAV,IAAI;IACJC,eAAe;IACfC,SAAS;IACTyC,OAAO,EAAExC,YAAY;IACrBC,KAAK;IAEL;IACAC,MAAM;IACNmC,OAAO;IACPC,UAAU;IACVC,OAAO;IAEP;IACA/B,WAAW;IACXG,eAAe;IACfC;EACF,CAAC;AACH;;AAEA;AACA,SAASlB,MAAM,QAAQ,0BAAuB","ignoreList":[]}
|
|
@@ -27,12 +27,13 @@ function isWebBrowser() {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Check if we're on the identity provider domain (where FedCM would authenticate against itself)
|
|
30
|
-
*
|
|
30
|
+
* Compares against config.authWebUrl if set, otherwise defaults to auth.oxy.so
|
|
31
31
|
*/
|
|
32
|
-
function isIdentityProvider() {
|
|
32
|
+
function isIdentityProvider(authWebUrl) {
|
|
33
33
|
if (!isWebBrowser()) return false;
|
|
34
34
|
const hostname = window.location.hostname;
|
|
35
|
-
|
|
35
|
+
const idpHostname = authWebUrl ? new URL(authWebUrl).hostname : 'auth.oxy.so';
|
|
36
|
+
return hostname === idpHostname;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
/**
|
|
@@ -63,13 +64,14 @@ export function useWebSSO({
|
|
|
63
64
|
|
|
64
65
|
// Check FedCM support once
|
|
65
66
|
const fedCMSupported = isWebBrowser() && oxyServices.isFedCMSupported?.();
|
|
67
|
+
const authWebUrl = oxyServices.config?.authWebUrl;
|
|
66
68
|
const checkSSO = useCallback(async () => {
|
|
67
69
|
if (!isWebBrowser() || isCheckingRef.current) {
|
|
68
70
|
return null;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
// Don't use FedCM on the auth domain itself - it would authenticate against itself
|
|
72
|
-
if (isIdentityProvider()) {
|
|
74
|
+
if (isIdentityProvider(authWebUrl)) {
|
|
73
75
|
onSSOUnavailable?.();
|
|
74
76
|
return null;
|
|
75
77
|
}
|
|
@@ -95,7 +97,7 @@ export function useWebSSO({
|
|
|
95
97
|
} finally {
|
|
96
98
|
isCheckingRef.current = false;
|
|
97
99
|
}
|
|
98
|
-
}, [oxyServices, onSessionFound, onSSOUnavailable, onError, fedCMSupported]);
|
|
100
|
+
}, [oxyServices, onSessionFound, onSSOUnavailable, onError, fedCMSupported, authWebUrl]);
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
103
|
* Trigger interactive FedCM sign-in
|
|
@@ -128,8 +130,8 @@ export function useWebSSO({
|
|
|
128
130
|
|
|
129
131
|
// Auto-check SSO on mount (web only, FedCM only, not on auth domain)
|
|
130
132
|
useEffect(() => {
|
|
131
|
-
if (!enabled || !isWebBrowser() || hasCheckedRef.current || isIdentityProvider()) {
|
|
132
|
-
if (isIdentityProvider()) {
|
|
133
|
+
if (!enabled || !isWebBrowser() || hasCheckedRef.current || isIdentityProvider(authWebUrl)) {
|
|
134
|
+
if (isIdentityProvider(authWebUrl)) {
|
|
133
135
|
onSSOUnavailable?.();
|
|
134
136
|
}
|
|
135
137
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useCallback","isWebBrowser","window","document","documentElement","isIdentityProvider","hostname","location","useWebSSO","oxyServices","onSessionFound","onSSOUnavailable","onError","enabled","isCheckingRef","hasCheckedRef","fedCMSupported","isFedCMSupported","checkSSO","current","session","silentSignInWithFedCM","error","Error","String","signInWithFedCM","isChecking"],"sourceRoot":"../../../../src","sources":["ui/hooks/useWebSSO.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAuBtD;AACA;AACA;AACA,SAASC,YAAYA,CAAA,EAAY;EAC/B,OAAO,OAAOC,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK,WAAW,IAC/B,OAAOA,QAAQ,CAACC,eAAe,KAAK,WAAW;AACxD;;AAEA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useCallback","isWebBrowser","window","document","documentElement","isIdentityProvider","authWebUrl","hostname","location","idpHostname","URL","useWebSSO","oxyServices","onSessionFound","onSSOUnavailable","onError","enabled","isCheckingRef","hasCheckedRef","fedCMSupported","isFedCMSupported","config","checkSSO","current","session","silentSignInWithFedCM","error","Error","String","signInWithFedCM","isChecking"],"sourceRoot":"../../../../src","sources":["ui/hooks/useWebSSO.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAuBtD;AACA;AACA;AACA,SAASC,YAAYA,CAAA,EAAY;EAC/B,OAAO,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,CAAC,CAAC;MACpE,OAAO,IAAI;IACb,CAAC,SAAS;MACRT,aAAa,CAACM,OAAO,GAAG,KAAK;IAC/B;EACF,CAAC,EAAE,CAACX,WAAW,EAAEC,cAAc,EAAEE,OAAO,EAAEI,cAAc,CAAC,CAAC;;EAE1D;EACArB,SAAS,CAAC,MAAM;IACd,IAAI,CAACkB,OAAO,IAAI,CAACf,YAAY,CAAC,CAAC,IAAIiB,aAAa,CAACK,OAAO,IAAIlB,kBAAkB,CAACC,UAAU,CAAC,EAAE;MAC1F,IAAID,kBAAkB,CAACC,UAAU,CAAC,EAAE;QAClCQ,gBAAgB,GAAG,CAAC;MACtB;MACA;IACF;IAEAI,aAAa,CAACK,OAAO,GAAG,IAAI;IAE5B,IAAIJ,cAAc,EAAE;MAClBG,QAAQ,CAAC,CAAC;IACZ,CAAC,MAAM;MACLR,gBAAgB,GAAG,CAAC;IACtB;EACF,CAAC,EAAE,CAACE,OAAO,EAAEM,QAAQ,EAAEH,cAAc,EAAEL,gBAAgB,CAAC,CAAC;EAEzD,OAAO;IACLQ,QAAQ;IACRO,eAAe;IACfC,UAAU,EAAEb,aAAa,CAACM,OAAO;IACjCH,gBAAgB,EAAED;EACpB,CAAC;AACH;AAEA,SAASlB,YAAY","ignoreList":[]}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
4
|
-
*
|
|
3
|
+
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
4
|
+
* This works in both the package development and when consumed as an npm package
|
|
5
|
+
* Children render immediately with system fonts as fallback until custom fonts are loaded
|
|
5
6
|
*/
|
|
6
7
|
export declare const FontLoader: ({ children, }: {
|
|
7
8
|
children: React.ReactNode;
|
|
8
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
/**
|
|
10
|
-
* Setup fonts for applications consuming this package
|
|
11
|
+
* Setup fonts for applications consuming this package
|
|
12
|
+
* This should be called by applications using your package
|
|
11
13
|
*/
|
|
12
14
|
export declare const setupFonts: () => Promise<boolean>;
|
|
13
15
|
//# sourceMappingURL=FontLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontLoader.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/FontLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FontLoader.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/FontLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8B/B;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,eAExB;IACC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,4CAqCA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,wBA+EtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useAuth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,WAAW,SAAS;IACxB,4DAA4D;IAC5D,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAElB,oCAAoC;IACpC,eAAe,EAAE,OAAO,CAAC;IAEzB,4DAA4D;IAC5D,SAAS,EAAE,OAAO,CAAC;IAEnB,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IAEjB,oCAAoC;IACpC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CA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EACxB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,OAAc,GACf,EAAE,gBAAgB,GAAG,eAAe,CAwGpC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
4
|
-
*
|
|
3
|
+
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
4
|
+
* This works in both the package development and when consumed as an npm package
|
|
5
|
+
* Children render immediately with system fonts as fallback until custom fonts are loaded
|
|
5
6
|
*/
|
|
6
7
|
export declare const FontLoader: ({ children, }: {
|
|
7
8
|
children: React.ReactNode;
|
|
8
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
/**
|
|
10
|
-
* Setup fonts for applications consuming this package
|
|
11
|
+
* Setup fonts for applications consuming this package
|
|
12
|
+
* This should be called by applications using your package
|
|
11
13
|
*/
|
|
12
14
|
export declare const setupFonts: () => Promise<boolean>;
|
|
13
15
|
//# sourceMappingURL=FontLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontLoader.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/FontLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FontLoader.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/FontLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8B/B;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,eAExB;IACC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,4CAqCA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,wBA+EtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","sourceRoot":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,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebSSO.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useWebSSO.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,UAAU,gBAAgB;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,eAAe;IACvB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IACrD,2DAA2D;IAC3D,eAAe,EAAE,MAAM,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAC5D,uCAAuC;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,iDAAiD;IACjD,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,iBAAS,YAAY,IAAI,OAAO,CAI/B;
|
|
1
|
+
{"version":3,"file":"useWebSSO.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useWebSSO.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,UAAU,gBAAgB;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,eAAe;IACvB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IACrD,2DAA2D;IAC3D,eAAe,EAAE,MAAM,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAC5D,uCAAuC;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,iDAAiD;IACjD,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,iBAAS,YAAY,IAAI,OAAO,CAI/B;AAaD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,EACxB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,OAAc,GACf,EAAE,gBAAgB,GAAG,eAAe,CAwGpC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,28 +3,35 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
4
|
import * as Font from 'expo-font';
|
|
5
5
|
|
|
6
|
-
// Single variable font file that covers all weights (100–900)
|
|
7
|
-
const InterVariable = require('../../assets/fonts/Inter/InterVariable.ttf');
|
|
8
|
-
|
|
9
|
-
const WEIGHT_NAMES = ['Light', 'Regular', 'Medium', 'SemiBold', 'Bold', 'ExtraBold', 'Black'] as const;
|
|
10
|
-
|
|
11
6
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* per alias (e.g. Inter-Regular, Inter-Bold) to keep fontFamily references working.
|
|
7
|
+
* Get the Inter font sources for both native and web environments
|
|
8
|
+
* This is specifically designed to work when distributed as an npm package
|
|
15
9
|
*/
|
|
16
|
-
const getInterFonts = ()
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
const getInterFonts = () => {
|
|
11
|
+
try {
|
|
12
|
+
// For both development and when used as a package
|
|
13
|
+
// Load all static font weights
|
|
14
|
+
return {
|
|
15
|
+
'Inter-Light': require('../../assets/fonts/Inter/Inter_18pt-Light.ttf'),
|
|
16
|
+
'Inter-Regular': require('../../assets/fonts/Inter/Inter_18pt-Regular.ttf'),
|
|
17
|
+
'Inter-Medium': require('../../assets/fonts/Inter/Inter_18pt-Medium.ttf'),
|
|
18
|
+
'Inter-SemiBold': require('../../assets/fonts/Inter/Inter_18pt-SemiBold.ttf'),
|
|
19
|
+
'Inter-Bold': require('../../assets/fonts/Inter/Inter_18pt-Bold.ttf'),
|
|
20
|
+
'Inter-ExtraBold': require('../../assets/fonts/Inter/Inter_18pt-ExtraBold.ttf'),
|
|
21
|
+
'Inter-Black': require('../../assets/fonts/Inter/Inter_18pt-Black.ttf'),
|
|
22
|
+
};
|
|
23
|
+
} catch (error) {
|
|
24
|
+
if (__DEV__) {
|
|
25
|
+
console.warn('Failed to load Inter fonts:', error);
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
21
28
|
}
|
|
22
|
-
return fontMap;
|
|
23
29
|
};
|
|
24
30
|
|
|
25
31
|
/**
|
|
26
|
-
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
27
|
-
*
|
|
32
|
+
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
33
|
+
* This works in both the package development and when consumed as an npm package
|
|
34
|
+
* Children render immediately with system fonts as fallback until custom fonts are loaded
|
|
28
35
|
*/
|
|
29
36
|
export const FontLoader = ({
|
|
30
37
|
children,
|
|
@@ -34,53 +41,122 @@ export const FontLoader = ({
|
|
|
34
41
|
const [fontState, setFontState] = useState<'loading' | 'loaded' | 'error'>('loading');
|
|
35
42
|
|
|
36
43
|
useEffect(() => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
const loadFonts = async () => {
|
|
45
|
+
try {
|
|
46
|
+
// Get all the font weights
|
|
47
|
+
const interFonts = getInterFonts();
|
|
48
|
+
|
|
49
|
+
if (!interFonts) {
|
|
50
|
+
throw new Error('Inter font files not found');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Load all the static Inter fonts with their respective weights
|
|
54
|
+
await Font.loadAsync(interFonts);
|
|
55
|
+
|
|
56
|
+
setFontState('loaded');
|
|
57
|
+
} catch (error) {
|
|
40
58
|
if (__DEV__) {
|
|
41
|
-
|
|
59
|
+
console.error('Error loading fonts:', error);
|
|
42
60
|
}
|
|
43
61
|
setFontState('error');
|
|
44
|
-
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
loadFonts();
|
|
45
66
|
}, []);
|
|
46
67
|
|
|
68
|
+
// Always render children immediately - fonts will load in background
|
|
69
|
+
// If fonts aren't loaded yet, the app will use system fonts as fallback
|
|
47
70
|
if (fontState === 'error' && __DEV__) {
|
|
48
71
|
console.warn('Fonts failed to load. Using system fonts instead.');
|
|
49
72
|
}
|
|
50
73
|
|
|
74
|
+
// Render children immediately, even while fonts are loading
|
|
75
|
+
// Fonts will apply when they're ready, otherwise system fonts are used
|
|
51
76
|
return <>{children}</>;
|
|
52
77
|
};
|
|
53
78
|
|
|
54
79
|
/**
|
|
55
|
-
* Setup fonts for applications consuming this package
|
|
80
|
+
* Setup fonts for applications consuming this package
|
|
81
|
+
* This should be called by applications using your package
|
|
56
82
|
*/
|
|
57
|
-
export const setupFonts = async ()
|
|
83
|
+
export const setupFonts = async () => {
|
|
58
84
|
try {
|
|
59
85
|
const interFonts = getInterFonts();
|
|
60
86
|
|
|
87
|
+
if (!interFonts) {
|
|
88
|
+
throw new Error('Inter font files not found');
|
|
89
|
+
}
|
|
90
|
+
|
|
61
91
|
if (Platform.OS === 'web') {
|
|
92
|
+
// For web platform, dynamically inject CSS to load the fonts
|
|
62
93
|
if (typeof document !== 'undefined') {
|
|
94
|
+
// Create a style element
|
|
63
95
|
const style = document.createElement('style');
|
|
64
|
-
|
|
96
|
+
|
|
97
|
+
// Define @font-face rules for each font weight
|
|
98
|
+
const fontFaceRules = `
|
|
99
|
+
@font-face {
|
|
100
|
+
font-family: 'Inter';
|
|
101
|
+
src: url(${interFonts['Inter-Light']}) format('truetype');
|
|
102
|
+
font-weight: 300;
|
|
103
|
+
font-style: normal;
|
|
104
|
+
}
|
|
105
|
+
@font-face {
|
|
106
|
+
font-family: 'Inter';
|
|
107
|
+
src: url(${interFonts['Inter-Regular']}) format('truetype');
|
|
108
|
+
font-weight: 400;
|
|
109
|
+
font-style: normal;
|
|
110
|
+
}
|
|
111
|
+
@font-face {
|
|
112
|
+
font-family: 'Inter';
|
|
113
|
+
src: url(${interFonts['Inter-Medium']}) format('truetype');
|
|
114
|
+
font-weight: 500;
|
|
115
|
+
font-style: normal;
|
|
116
|
+
}
|
|
65
117
|
@font-face {
|
|
66
118
|
font-family: 'Inter';
|
|
67
|
-
src: url(${
|
|
68
|
-
font-weight:
|
|
119
|
+
src: url(${interFonts['Inter-SemiBold']}) format('truetype');
|
|
120
|
+
font-weight: 600;
|
|
121
|
+
font-style: normal;
|
|
122
|
+
}
|
|
123
|
+
@font-face {
|
|
124
|
+
font-family: 'Inter';
|
|
125
|
+
src: url(${interFonts['Inter-Bold']}) format('truetype');
|
|
126
|
+
font-weight: 700;
|
|
127
|
+
font-style: normal;
|
|
128
|
+
}
|
|
129
|
+
@font-face {
|
|
130
|
+
font-family: 'Inter';
|
|
131
|
+
src: url(${interFonts['Inter-ExtraBold']}) format('truetype');
|
|
132
|
+
font-weight: 800;
|
|
133
|
+
font-style: normal;
|
|
134
|
+
}
|
|
135
|
+
@font-face {
|
|
136
|
+
font-family: 'Inter';
|
|
137
|
+
src: url(${interFonts['Inter-Black']}) format('truetype');
|
|
138
|
+
font-weight: 900;
|
|
69
139
|
font-style: normal;
|
|
70
140
|
}
|
|
71
141
|
`;
|
|
142
|
+
|
|
143
|
+
style.textContent = fontFaceRules;
|
|
72
144
|
document.head.appendChild(style);
|
|
145
|
+
if (__DEV__) {
|
|
146
|
+
console.info('All Inter web fonts have been dynamically loaded');
|
|
147
|
+
}
|
|
73
148
|
}
|
|
74
149
|
} else {
|
|
150
|
+
// Attempt to load the fonts anyway (this works if the consumer has linked the assets)
|
|
75
151
|
await Font.loadAsync(interFonts);
|
|
76
152
|
}
|
|
77
153
|
|
|
78
154
|
return true;
|
|
79
155
|
} catch (error: unknown) {
|
|
80
156
|
if (__DEV__) {
|
|
81
|
-
|
|
82
|
-
|
|
157
|
+
const errorMessage = error instanceof Error ? (error instanceof Error ? error.message : null) : String(error);
|
|
158
|
+
console.warn('Error setting up fonts:', errorMessage);
|
|
83
159
|
}
|
|
84
160
|
return false;
|
|
85
161
|
}
|
|
86
|
-
};
|
|
162
|
+
};
|
package/src/ui/hooks/useAuth.ts
CHANGED
|
@@ -107,10 +107,12 @@ export function useAuth(): UseAuthReturn {
|
|
|
107
107
|
} = useOxy();
|
|
108
108
|
|
|
109
109
|
const signIn = useCallback(async (publicKey?: string): Promise<User> => {
|
|
110
|
-
// Check if we're on the identity provider itself
|
|
111
|
-
// Only
|
|
110
|
+
// Check if we're on the identity provider itself
|
|
111
|
+
// Only the IdP has local login forms - other apps are client apps
|
|
112
|
+
const authWebUrl = oxyServices.config?.authWebUrl;
|
|
113
|
+
const idpHostname = authWebUrl ? new URL(authWebUrl).hostname : 'auth.oxy.so';
|
|
112
114
|
const isIdentityProvider = isWebBrowser() &&
|
|
113
|
-
window.location.hostname ===
|
|
115
|
+
window.location.hostname === idpHostname;
|
|
114
116
|
|
|
115
117
|
// Web (not on IdP): Use popup-based authentication
|
|
116
118
|
// We go straight to popup to preserve the "user gesture" (click event)
|
|
@@ -166,9 +168,10 @@ export function useAuth(): UseAuthReturn {
|
|
|
166
168
|
|
|
167
169
|
// Web fallback: navigate to login page on auth domain
|
|
168
170
|
if (isWebBrowser()) {
|
|
171
|
+
const authBase = authWebUrl || 'https://accounts.oxy.so';
|
|
169
172
|
const loginUrl = window.location.hostname.includes('oxy.so')
|
|
170
173
|
? '/login'
|
|
171
|
-
:
|
|
174
|
+
: `${authBase}/login`;
|
|
172
175
|
window.location.href = loginUrl;
|
|
173
176
|
return new Promise(() => {}); // Never resolves, page will redirect
|
|
174
177
|
}
|
|
@@ -49,12 +49,13 @@ function isWebBrowser(): boolean {
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Check if we're on the identity provider domain (where FedCM would authenticate against itself)
|
|
52
|
-
*
|
|
52
|
+
* Compares against config.authWebUrl if set, otherwise defaults to auth.oxy.so
|
|
53
53
|
*/
|
|
54
|
-
function isIdentityProvider(): boolean {
|
|
54
|
+
function isIdentityProvider(authWebUrl?: string): boolean {
|
|
55
55
|
if (!isWebBrowser()) return false;
|
|
56
56
|
const hostname = window.location.hostname;
|
|
57
|
-
|
|
57
|
+
const idpHostname = authWebUrl ? new URL(authWebUrl).hostname : 'auth.oxy.so';
|
|
58
|
+
return hostname === idpHostname;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/**
|
|
@@ -85,6 +86,7 @@ export function useWebSSO({
|
|
|
85
86
|
|
|
86
87
|
// Check FedCM support once
|
|
87
88
|
const fedCMSupported = isWebBrowser() && oxyServices.isFedCMSupported?.();
|
|
89
|
+
const authWebUrl = oxyServices.config?.authWebUrl;
|
|
88
90
|
|
|
89
91
|
const checkSSO = useCallback(async (): Promise<SessionLoginResponse | null> => {
|
|
90
92
|
if (!isWebBrowser() || isCheckingRef.current) {
|
|
@@ -92,7 +94,7 @@ export function useWebSSO({
|
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
// Don't use FedCM on the auth domain itself - it would authenticate against itself
|
|
95
|
-
if (isIdentityProvider()) {
|
|
97
|
+
if (isIdentityProvider(authWebUrl)) {
|
|
96
98
|
onSSOUnavailable?.();
|
|
97
99
|
return null;
|
|
98
100
|
}
|
|
@@ -122,7 +124,7 @@ export function useWebSSO({
|
|
|
122
124
|
} finally {
|
|
123
125
|
isCheckingRef.current = false;
|
|
124
126
|
}
|
|
125
|
-
}, [oxyServices, onSessionFound, onSSOUnavailable, onError, fedCMSupported]);
|
|
127
|
+
}, [oxyServices, onSessionFound, onSSOUnavailable, onError, fedCMSupported, authWebUrl]);
|
|
126
128
|
|
|
127
129
|
/**
|
|
128
130
|
* Trigger interactive FedCM sign-in
|
|
@@ -160,8 +162,8 @@ export function useWebSSO({
|
|
|
160
162
|
|
|
161
163
|
// Auto-check SSO on mount (web only, FedCM only, not on auth domain)
|
|
162
164
|
useEffect(() => {
|
|
163
|
-
if (!enabled || !isWebBrowser() || hasCheckedRef.current || isIdentityProvider()) {
|
|
164
|
-
if (isIdentityProvider()) {
|
|
165
|
+
if (!enabled || !isWebBrowser() || hasCheckedRef.current || isIdentityProvider(authWebUrl)) {
|
|
166
|
+
if (isIdentityProvider(authWebUrl)) {
|
|
165
167
|
onSSOUnavailable?.();
|
|
166
168
|
}
|
|
167
169
|
return;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|