flowlink-auth 2.6.9 → 2.7.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.
- package/dist/ErrorBox.js +0 -1
- package/dist/SignIn.js +1 -2
- package/dist/SignUp.js +1 -2
- package/dist/api.js +0 -1
- package/dist/createAuthMiddleware.js +0 -1
- package/dist/index.js +1069 -47
- package/dist/init.js +5 -6
- package/dist/provider.js +3 -4
- package/dist/securityUtils.js +0 -1
- package/dist/useAuth.js +1 -2
- package/package.json +2 -2
package/dist/init.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/init.js
|
|
2
2
|
var CONFIG = null;
|
|
3
|
-
function
|
|
4
|
-
if (!publishableKey) throw new Error("flowlink-auth: publishableKey is required in
|
|
5
|
-
if (!baseUrl) throw new Error("flowlink-auth: baseUrl is required in
|
|
3
|
+
function initFlowlinkAuth({ publishableKey, baseUrl, opts } = {}) {
|
|
4
|
+
if (!publishableKey) throw new Error("flowlink-auth: publishableKey is required in initFlowlinkAuth()");
|
|
5
|
+
if (!baseUrl) throw new Error("flowlink-auth: baseUrl is required in initFlowlinkAuth()");
|
|
6
6
|
if (!publishableKey.startsWith("pk_")) {
|
|
7
7
|
console.warn('flowlink-auth: publishableKey should start with "pk_"');
|
|
8
8
|
}
|
|
@@ -57,7 +57,7 @@ function getConfigSafe() {
|
|
|
57
57
|
return CONFIG;
|
|
58
58
|
}
|
|
59
59
|
function getConfig() {
|
|
60
|
-
if (!CONFIG) throw new Error("flowlink-auth: SDK not initialized. Call
|
|
60
|
+
if (!CONFIG) throw new Error("flowlink-auth: SDK not initialized. Call initFlowlinkAuth(...) or wrap components in FlowlinkAuthProvider with keys.");
|
|
61
61
|
return CONFIG;
|
|
62
62
|
}
|
|
63
63
|
function getCSRFToken() {
|
|
@@ -67,7 +67,6 @@ export {
|
|
|
67
67
|
getCSRFToken,
|
|
68
68
|
getConfig,
|
|
69
69
|
getConfigSafe,
|
|
70
|
-
|
|
70
|
+
initFlowlinkAuth,
|
|
71
71
|
setConfigFromProvider
|
|
72
72
|
};
|
|
73
|
-
|
package/dist/provider.js
CHANGED
|
@@ -1041,7 +1041,7 @@ function getSafeErrorMessage(error) {
|
|
|
1041
1041
|
|
|
1042
1042
|
// src/provider.js
|
|
1043
1043
|
var AuthContext = (0, import_react.createContext)(null);
|
|
1044
|
-
var
|
|
1044
|
+
var FlowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) => {
|
|
1045
1045
|
const [ready, setReady] = (0, import_react.useState)(false);
|
|
1046
1046
|
const [error, setError] = (0, import_react.useState)(null);
|
|
1047
1047
|
const [user, setUser] = (0, import_react.useState)(null);
|
|
@@ -1210,10 +1210,10 @@ var flowlinkAuthProvider = ({ children, publishableKey, baseUrl, redirect }) =>
|
|
|
1210
1210
|
};
|
|
1211
1211
|
var useAuth = () => {
|
|
1212
1212
|
const ctx = (0, import_react.useContext)(AuthContext);
|
|
1213
|
-
if (!ctx) throw new Error("useAuth must be used within
|
|
1213
|
+
if (!ctx) throw new Error("useAuth must be used within FlowlinkAuthProvider");
|
|
1214
1214
|
return ctx;
|
|
1215
1215
|
};
|
|
1216
|
-
var provider_default =
|
|
1216
|
+
var provider_default = FlowlinkAuthProvider;
|
|
1217
1217
|
export {
|
|
1218
1218
|
provider_default as default,
|
|
1219
1219
|
useAuth
|
|
@@ -1231,4 +1231,3 @@ react/cjs/react.development.js:
|
|
|
1231
1231
|
* LICENSE file in the root directory of this source tree.
|
|
1232
1232
|
*)
|
|
1233
1233
|
*/
|
|
1234
|
-
|
package/dist/securityUtils.js
CHANGED
package/dist/useAuth.js
CHANGED
|
@@ -1030,7 +1030,7 @@ function checkSecureContext() {
|
|
|
1030
1030
|
var AuthContext = (0, import_react.createContext)(null);
|
|
1031
1031
|
var useAuth = () => {
|
|
1032
1032
|
const ctx = (0, import_react.useContext)(AuthContext);
|
|
1033
|
-
if (!ctx) throw new Error("useAuth must be used within
|
|
1033
|
+
if (!ctx) throw new Error("useAuth must be used within FlowlinkAuthProvider");
|
|
1034
1034
|
return ctx;
|
|
1035
1035
|
};
|
|
1036
1036
|
|
|
@@ -1054,4 +1054,3 @@ react/cjs/react.development.js:
|
|
|
1054
1054
|
* LICENSE file in the root directory of this source tree.
|
|
1055
1055
|
*)
|
|
1056
1056
|
*/
|
|
1057
|
-
|
package/package.json
CHANGED