react-redux-django-auth 1.3.2 → 1.3.3
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/index.d.mts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +41 -0
- package/dist/index.mjs +24 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -112,4 +112,37 @@ type AuthProviderProps = {
|
|
|
112
112
|
};
|
|
113
113
|
declare const AuthProvider: React$1.FC<AuthProviderProps>;
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
/**
|
|
116
|
+
* A type representing a single error message string.
|
|
117
|
+
*/
|
|
118
|
+
type ErrorMessage = string;
|
|
119
|
+
/**
|
|
120
|
+
* A type representing an array of error messages.
|
|
121
|
+
*/
|
|
122
|
+
type ErrorMessageArray = string[];
|
|
123
|
+
/**
|
|
124
|
+
* A type representing an object where keys map to either a single error message
|
|
125
|
+
* or an array of error messages.
|
|
126
|
+
*/
|
|
127
|
+
type ErrorMessageObject = {
|
|
128
|
+
[key: string]: ErrorMessage | ErrorMessageArray;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* A union type for all possible error message inputs.
|
|
132
|
+
*/
|
|
133
|
+
type ErrorMessageType = ErrorMessage | ErrorMessageArray | ErrorMessageObject;
|
|
134
|
+
/**
|
|
135
|
+
* Extracts and flattens various error message formats into a single array of strings.
|
|
136
|
+
*
|
|
137
|
+
* This function can handle:
|
|
138
|
+
* - A single string: Returns an array with that string.
|
|
139
|
+
* - An array of strings: Returns the array as is.
|
|
140
|
+
* - An object: Iterates through the object's values and extracts all strings
|
|
141
|
+
* and strings from arrays into a single flattened array.
|
|
142
|
+
*
|
|
143
|
+
* @param errorMsg The error message(s) to extract, which can be a string, array, or object.
|
|
144
|
+
* @returns A flattened array of error message strings.
|
|
145
|
+
*/
|
|
146
|
+
declare const extractErrorMessages: (errorMsg: ErrorMessageType) => string[];
|
|
147
|
+
|
|
148
|
+
export { AuthProvider, extractErrorMessages, useActivate, useAuthicatedUser, useChangeAuthenticatedUserPassword, useFacebookAuth, useGoogleAuth, useLogin, useLogout, usePasswordConfirm, useResetPassword, useSignup };
|
package/dist/index.d.ts
CHANGED
|
@@ -112,4 +112,37 @@ type AuthProviderProps = {
|
|
|
112
112
|
};
|
|
113
113
|
declare const AuthProvider: React$1.FC<AuthProviderProps>;
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
/**
|
|
116
|
+
* A type representing a single error message string.
|
|
117
|
+
*/
|
|
118
|
+
type ErrorMessage = string;
|
|
119
|
+
/**
|
|
120
|
+
* A type representing an array of error messages.
|
|
121
|
+
*/
|
|
122
|
+
type ErrorMessageArray = string[];
|
|
123
|
+
/**
|
|
124
|
+
* A type representing an object where keys map to either a single error message
|
|
125
|
+
* or an array of error messages.
|
|
126
|
+
*/
|
|
127
|
+
type ErrorMessageObject = {
|
|
128
|
+
[key: string]: ErrorMessage | ErrorMessageArray;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* A union type for all possible error message inputs.
|
|
132
|
+
*/
|
|
133
|
+
type ErrorMessageType = ErrorMessage | ErrorMessageArray | ErrorMessageObject;
|
|
134
|
+
/**
|
|
135
|
+
* Extracts and flattens various error message formats into a single array of strings.
|
|
136
|
+
*
|
|
137
|
+
* This function can handle:
|
|
138
|
+
* - A single string: Returns an array with that string.
|
|
139
|
+
* - An array of strings: Returns the array as is.
|
|
140
|
+
* - An object: Iterates through the object's values and extracts all strings
|
|
141
|
+
* and strings from arrays into a single flattened array.
|
|
142
|
+
*
|
|
143
|
+
* @param errorMsg The error message(s) to extract, which can be a string, array, or object.
|
|
144
|
+
* @returns A flattened array of error message strings.
|
|
145
|
+
*/
|
|
146
|
+
declare const extractErrorMessages: (errorMsg: ErrorMessageType) => string[];
|
|
147
|
+
|
|
148
|
+
export { AuthProvider, extractErrorMessages, useActivate, useAuthicatedUser, useChangeAuthenticatedUserPassword, useFacebookAuth, useGoogleAuth, useLogin, useLogout, usePasswordConfirm, useResetPassword, useSignup };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ function _array_like_to_array(arr, len) {
|
|
|
7
7
|
function _array_with_holes(arr) {
|
|
8
8
|
if (Array.isArray(arr)) return arr;
|
|
9
9
|
}
|
|
10
|
+
function _array_without_holes(arr) {
|
|
11
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
|
+
}
|
|
10
13
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
11
14
|
try {
|
|
12
15
|
var info = gen[key](arg);
|
|
@@ -49,6 +52,9 @@ function _define_property(obj, key, value) {
|
|
|
49
52
|
}
|
|
50
53
|
return obj;
|
|
51
54
|
}
|
|
55
|
+
function _iterable_to_array(iter) {
|
|
56
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
57
|
+
}
|
|
52
58
|
function _iterable_to_array_limit(arr, i) {
|
|
53
59
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
54
60
|
if (_i == null) return;
|
|
@@ -76,6 +82,9 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
76
82
|
function _non_iterable_rest() {
|
|
77
83
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
78
84
|
}
|
|
85
|
+
function _non_iterable_spread() {
|
|
86
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
87
|
+
}
|
|
79
88
|
function _object_spread(target) {
|
|
80
89
|
for(var i = 1; i < arguments.length; i++){
|
|
81
90
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -118,6 +127,9 @@ function _object_spread_props(target, source) {
|
|
|
118
127
|
function _sliced_to_array(arr, i) {
|
|
119
128
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
120
129
|
}
|
|
130
|
+
function _to_consumable_array(arr) {
|
|
131
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
132
|
+
}
|
|
121
133
|
function _type_of(obj) {
|
|
122
134
|
"@swc/helpers - typeof";
|
|
123
135
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -285,6 +297,9 @@ __export(src_exports, {
|
|
|
285
297
|
AuthProvider: function() {
|
|
286
298
|
return app_default;
|
|
287
299
|
},
|
|
300
|
+
extractErrorMessages: function() {
|
|
301
|
+
return extractErrorMessages;
|
|
302
|
+
},
|
|
288
303
|
useActivate: function() {
|
|
289
304
|
return useActivate_default;
|
|
290
305
|
},
|
|
@@ -1996,9 +2011,35 @@ var AuthProvider = function(param) {
|
|
|
1996
2011
|
}, children);
|
|
1997
2012
|
};
|
|
1998
2013
|
var app_default = AuthProvider;
|
|
2014
|
+
// src/utils/ExtractErrorMsg.tsx
|
|
2015
|
+
var extractErrorMessages = function(errorMsg) {
|
|
2016
|
+
if (typeof errorMsg === "string") {
|
|
2017
|
+
return [
|
|
2018
|
+
errorMsg
|
|
2019
|
+
];
|
|
2020
|
+
}
|
|
2021
|
+
if (Array.isArray(errorMsg)) {
|
|
2022
|
+
return errorMsg;
|
|
2023
|
+
}
|
|
2024
|
+
if ((typeof errorMsg === "undefined" ? "undefined" : _type_of(errorMsg)) === "object" && errorMsg !== null) {
|
|
2025
|
+
var extractedMessages = [];
|
|
2026
|
+
Object.keys(errorMsg).forEach(function(key) {
|
|
2027
|
+
var value = errorMsg[key];
|
|
2028
|
+
if (Array.isArray(value)) {
|
|
2029
|
+
var _extractedMessages;
|
|
2030
|
+
(_extractedMessages = extractedMessages).push.apply(_extractedMessages, _to_consumable_array(value));
|
|
2031
|
+
} else if (typeof value === "string") {
|
|
2032
|
+
extractedMessages.push(value);
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
return extractedMessages;
|
|
2036
|
+
}
|
|
2037
|
+
return [];
|
|
2038
|
+
};
|
|
1999
2039
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2000
2040
|
0 && (module.exports = {
|
|
2001
2041
|
AuthProvider: AuthProvider,
|
|
2042
|
+
extractErrorMessages: extractErrorMessages,
|
|
2002
2043
|
useActivate: useActivate,
|
|
2003
2044
|
useAuthicatedUser: useAuthicatedUser,
|
|
2004
2045
|
useChangeAuthenticatedUserPassword: useChangeAuthenticatedUserPassword,
|
package/dist/index.mjs
CHANGED
|
@@ -871,8 +871,32 @@ var AuthProvider = ({ children }) => {
|
|
|
871
871
|
return /* @__PURE__ */ React.createElement(Provider, { store: store_default }, children);
|
|
872
872
|
};
|
|
873
873
|
var app_default = AuthProvider;
|
|
874
|
+
|
|
875
|
+
// src/utils/ExtractErrorMsg.tsx
|
|
876
|
+
var extractErrorMessages = (errorMsg) => {
|
|
877
|
+
if (typeof errorMsg === "string") {
|
|
878
|
+
return [errorMsg];
|
|
879
|
+
}
|
|
880
|
+
if (Array.isArray(errorMsg)) {
|
|
881
|
+
return errorMsg;
|
|
882
|
+
}
|
|
883
|
+
if (typeof errorMsg === "object" && errorMsg !== null) {
|
|
884
|
+
const extractedMessages = [];
|
|
885
|
+
Object.keys(errorMsg).forEach((key) => {
|
|
886
|
+
const value = errorMsg[key];
|
|
887
|
+
if (Array.isArray(value)) {
|
|
888
|
+
extractedMessages.push(...value);
|
|
889
|
+
} else if (typeof value === "string") {
|
|
890
|
+
extractedMessages.push(value);
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
return extractedMessages;
|
|
894
|
+
}
|
|
895
|
+
return [];
|
|
896
|
+
};
|
|
874
897
|
export {
|
|
875
898
|
app_default as AuthProvider,
|
|
899
|
+
extractErrorMessages,
|
|
876
900
|
useActivate_default as useActivate,
|
|
877
901
|
useLoadUser_default as useAuthicatedUser,
|
|
878
902
|
useChangePassword_default as useChangeAuthenticatedUserPassword,
|