pwa-auth 1.1.4 → 1.1.5
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/README.md +16 -9
- package/demo/index.html +6 -2
- package/deploy/css/font.d.ts +2 -0
- package/deploy/css/font.d.ts.map +1 -0
- package/deploy/css/font.js +16 -0
- package/deploy/css/form/button.d.ts +3 -0
- package/deploy/css/form/button.d.ts.map +1 -0
- package/deploy/css/form/button.js +68 -0
- package/deploy/css/form/input.d.ts +3 -0
- package/deploy/css/form/input.d.ts.map +1 -0
- package/deploy/css/form/input.js +24 -0
- package/deploy/css/form/label.d.ts +3 -0
- package/deploy/css/form/label.d.ts.map +1 -0
- package/deploy/css/form/label.js +23 -0
- package/deploy/css/form/list.d.ts +3 -0
- package/deploy/css/form/list.d.ts.map +1 -0
- package/deploy/css/form/list.js +12 -0
- package/deploy/css/svg.d.ts +4 -0
- package/deploy/css/svg.d.ts.map +1 -0
- package/deploy/css/svg.js +4 -0
- package/deploy/css/toggle.d.ts +2 -0
- package/deploy/css/toggle.d.ts.map +1 -0
- package/deploy/css/toggle.js +8 -0
- package/deploy/custom-elements/drawer/css/drawer.d.ts +3 -0
- package/deploy/custom-elements/drawer/css/drawer.d.ts.map +1 -0
- package/deploy/custom-elements/drawer/css/drawer.js +16 -0
- package/deploy/custom-elements/drawer/css/exit.d.ts +3 -0
- package/deploy/custom-elements/drawer/css/exit.d.ts.map +1 -0
- package/deploy/custom-elements/drawer/css/exit.js +46 -0
- package/deploy/custom-elements/drawer/css/link.d.ts +3 -0
- package/deploy/custom-elements/drawer/css/link.d.ts.map +1 -0
- package/deploy/custom-elements/drawer/css/link.js +12 -0
- package/deploy/custom-elements/drawer/css/paragraph.d.ts +3 -0
- package/deploy/custom-elements/drawer/css/paragraph.d.ts.map +1 -0
- package/deploy/custom-elements/drawer/css/paragraph.js +11 -0
- package/deploy/custom-elements/drawer/css/visibility.d.ts +3 -0
- package/deploy/custom-elements/drawer/css/visibility.d.ts.map +1 -0
- package/deploy/custom-elements/drawer/css/visibility.js +22 -0
- package/deploy/custom-elements/drawer/drawer.d.ts +35 -0
- package/deploy/custom-elements/drawer/drawer.d.ts.map +1 -0
- package/deploy/custom-elements/drawer/drawer.js +116 -0
- package/deploy/custom-elements/drawer/input/forgot.d.ts +16 -0
- package/deploy/custom-elements/drawer/input/forgot.d.ts.map +1 -0
- package/deploy/custom-elements/drawer/input/forgot.js +60 -0
- package/deploy/custom-elements/drawer/input/login.d.ts +20 -0
- package/deploy/custom-elements/drawer/input/login.d.ts.map +1 -0
- package/deploy/custom-elements/drawer/input/login.js +124 -0
- package/deploy/custom-elements/drawer/input/sign-up.d.ts +20 -0
- package/deploy/custom-elements/drawer/input/sign-up.d.ts.map +1 -0
- package/deploy/custom-elements/drawer/input/sign-up.js +135 -0
- package/deploy/custom-elements/icon/css/icon.d.ts +2 -0
- package/deploy/custom-elements/icon/css/icon.d.ts.map +1 -0
- package/deploy/custom-elements/icon/css/icon.js +62 -0
- package/deploy/custom-elements/icon/icon.d.ts +31 -0
- package/deploy/custom-elements/icon/icon.d.ts.map +1 -0
- package/deploy/custom-elements/icon/icon.js +73 -0
- package/deploy/custom-elements/settings/css/navigation.d.ts +2 -0
- package/deploy/custom-elements/settings/css/navigation.d.ts.map +1 -0
- package/deploy/custom-elements/settings/css/navigation.js +61 -0
- package/deploy/custom-elements/settings/css/uploader.d.ts +2 -0
- package/deploy/custom-elements/settings/css/uploader.d.ts.map +1 -0
- package/deploy/custom-elements/settings/css/uploader.js +40 -0
- package/deploy/custom-elements/settings/input/delete.d.ts +33 -0
- package/deploy/custom-elements/settings/input/delete.d.ts.map +1 -0
- package/deploy/custom-elements/settings/input/delete.js +78 -0
- package/deploy/custom-elements/settings/input/email.d.ts +34 -0
- package/deploy/custom-elements/settings/input/email.d.ts.map +1 -0
- package/deploy/custom-elements/settings/input/email.js +98 -0
- package/deploy/custom-elements/settings/input/images.d.ts +2 -0
- package/deploy/custom-elements/settings/input/images.d.ts.map +1 -0
- package/deploy/custom-elements/settings/input/images.js +22 -0
- package/deploy/custom-elements/settings/input/name.d.ts +33 -0
- package/deploy/custom-elements/settings/input/name.d.ts.map +1 -0
- package/deploy/custom-elements/settings/input/name.js +90 -0
- package/deploy/custom-elements/settings/input/password.d.ts +36 -0
- package/deploy/custom-elements/settings/input/password.d.ts.map +1 -0
- package/deploy/custom-elements/settings/input/password.js +145 -0
- package/deploy/custom-elements/settings/input/uploader.d.ts +34 -0
- package/deploy/custom-elements/settings/input/uploader.d.ts.map +1 -0
- package/deploy/custom-elements/settings/input/uploader.js +191 -0
- package/deploy/custom-elements/settings/settings.d.ts +36 -0
- package/deploy/custom-elements/settings/settings.d.ts.map +1 -0
- package/deploy/custom-elements/settings/settings.js +187 -0
- package/deploy/lazy-loader.d.ts +11 -0
- package/deploy/lazy-loader.d.ts.map +1 -0
- package/deploy/lazy-loader.js +20 -0
- package/deploy/redux/backend.d.ts +16 -0
- package/deploy/redux/backend.d.ts.map +1 -0
- package/deploy/redux/backend.js +43 -0
- package/deploy/redux/drawer.d.ts +18 -0
- package/deploy/redux/drawer.d.ts.map +1 -0
- package/deploy/redux/drawer.js +21 -0
- package/deploy/redux/frontend.d.ts +17 -0
- package/deploy/redux/frontend.d.ts.map +1 -0
- package/deploy/redux/frontend.js +67 -0
- package/deploy/redux/object.d.ts +24 -0
- package/deploy/redux/object.d.ts.map +1 -0
- package/deploy/redux/object.js +1 -0
- package/deploy/start.d.ts +14 -0
- package/deploy/start.d.ts.map +1 -0
- package/deploy/start.js +86 -0
- package/deploy/store.d.ts +19 -0
- package/deploy/store.d.ts.map +1 -0
- package/deploy/store.js +13 -0
- package/package.json +2 -2
- package/pwa-auth.js +3 -0
- package/npm/pwa-auth.js +0 -306
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface frontendAuth {
|
|
2
|
+
login: boolean;
|
|
3
|
+
drawer: boolean;
|
|
4
|
+
register: boolean;
|
|
5
|
+
settings: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
customer: string;
|
|
8
|
+
name: string;
|
|
9
|
+
photoURL: string;
|
|
10
|
+
phone: string;
|
|
11
|
+
email: string;
|
|
12
|
+
profileChoice: string;
|
|
13
|
+
}
|
|
14
|
+
export interface backendAuth {
|
|
15
|
+
verified: boolean;
|
|
16
|
+
anon: boolean;
|
|
17
|
+
userId: string;
|
|
18
|
+
name: string;
|
|
19
|
+
email: string;
|
|
20
|
+
photoURL: string;
|
|
21
|
+
phone: string;
|
|
22
|
+
msgToken: string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/redux/object.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAa,OAAO,CAAC;IAC1B,MAAM,EAAY,OAAO,CAAC;IAC1B,QAAQ,EAAU,OAAO,CAAC;IAE1B,QAAQ,EAAU,MAAM,CAAC;IACzB,MAAM,EAAY,MAAM,CAAC;IACzB,QAAQ,EAAU,MAAM,CAAC;IAEzB,IAAI,EAAc,MAAM,CAAC;IACzB,QAAQ,EAAU,MAAM,CAAC;IACzB,KAAK,EAAa,MAAM,CAAC;IACzB,KAAK,EAAa,MAAM,CAAC;IAEzB,aAAa,EAAK,MAAM,CAAA;CACzB;AAGD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAU,OAAO,CAAC;IAC1B,IAAI,EAAc,OAAO,CAAC;IAC1B,MAAM,EAAY,MAAM,CAAC;IAEzB,IAAI,EAAc,MAAM,CAAC;IACzB,KAAK,EAAa,MAAM,CAAC;IACzB,QAAQ,EAAU,MAAM,CAAC;IACzB,KAAK,EAAa,MAAM,CAAC;IAEzB,QAAQ,EAAU,MAAM,CAAA;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FirebaseApp } from 'firebase/app';
|
|
2
|
+
import { Auth, User } from 'firebase/auth';
|
|
3
|
+
import { Firestore } from "firebase/firestore";
|
|
4
|
+
import { FirebaseStorage } from "@firebase/storage";
|
|
5
|
+
export declare const application: FirebaseApp;
|
|
6
|
+
export declare const db: Firestore;
|
|
7
|
+
export declare const storage: FirebaseStorage;
|
|
8
|
+
export declare const auth: Auth;
|
|
9
|
+
export declare const user: User | null;
|
|
10
|
+
export declare const logOut: () => Promise<void>;
|
|
11
|
+
export declare const logAccount: () => Promise<void>;
|
|
12
|
+
export declare const logAccountDelete: () => Promise<void>;
|
|
13
|
+
export declare const deleteDocument: (collect: string, item: string) => Promise<void>;
|
|
14
|
+
//# sourceMappingURL=start.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAiB,MAAM,cAAc,CAAC;AAG1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAA+D,MAAM,eAAe,CAAC;AAGxG,OAAO,EAAgB,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAG7E,OAAO,EAAc,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAWhE,eAAO,MAAM,WAAW,EAAM,WAA0C,CAAC;AACzE,eAAO,MAAM,EAAE,EAAe,SAA6C,CAAC;AAC5E,eAAO,MAAM,OAAO,EAAU,eAA2C,CAAC;AAC1E,eAAO,MAAM,IAAI,EAAa,IAAwC,CAAC;AACvE,eAAO,MAAM,IAAI,EAAa,IAAI,GAAG,IAA6B,CAAC;AA+HnE,eAAO,MAAM,MAAM,qBAAoD,CAAC;AACxE,eAAO,MAAM,UAAU,qBAAiE,CAAC;AACzF,eAAO,MAAM,gBAAgB,qBAA2D,CAAC;AACzF,eAAO,MAAM,cAAc,GAAc,SAAQ,MAAM,EAAE,MAAK,MAAM,kBAInE,CAAC"}
|
package/deploy/start.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { store } from './store';
|
|
2
|
+
import { closeSign, iconAuth, nameAuth, userAuth } from './redux/frontend';
|
|
3
|
+
import { accID, accEmail, accImage, accName } from './redux/backend';
|
|
4
|
+
import { initializeApp } from 'firebase/app';
|
|
5
|
+
import { getAuth, onAuthStateChanged, sendEmailVerification, signOut } from 'firebase/auth';
|
|
6
|
+
import { getFirestore, doc, deleteDoc } from "firebase/firestore";
|
|
7
|
+
import { getStorage } from "@firebase/storage";
|
|
8
|
+
import { getAnalytics, logEvent } from "firebase/analytics";
|
|
9
|
+
import { isSupported } from "firebase/messaging";
|
|
10
|
+
export const application = initializeApp(connect);
|
|
11
|
+
export const db = getFirestore(application);
|
|
12
|
+
export const storage = getStorage(application);
|
|
13
|
+
export const auth = getAuth(application);
|
|
14
|
+
export const user = auth.currentUser;
|
|
15
|
+
getAuth().useDeviceLanguage();
|
|
16
|
+
let analytics;
|
|
17
|
+
(async () => {
|
|
18
|
+
if (await isSupported()) {
|
|
19
|
+
console.log('Firebase Analytics Supported');
|
|
20
|
+
analytics = getAnalytics(application);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
console.log("Firebase Analytics is not supported in this environment.");
|
|
24
|
+
}
|
|
25
|
+
})();
|
|
26
|
+
if ('serviceWorker' in navigator) {
|
|
27
|
+
console.log('Service Worker is supported');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.log('Service Worker is not supported');
|
|
31
|
+
}
|
|
32
|
+
if ('PushManager' in window) {
|
|
33
|
+
console.log('Push API is supported');
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
console.log('Push API is not supported');
|
|
37
|
+
}
|
|
38
|
+
let pendingEmailVerification = false;
|
|
39
|
+
window.addEventListener("userEmailChanged", () => {
|
|
40
|
+
pendingEmailVerification = true;
|
|
41
|
+
});
|
|
42
|
+
onAuthStateChanged(auth, (user) => {
|
|
43
|
+
if (user) {
|
|
44
|
+
store.dispatch(userAuth(true));
|
|
45
|
+
store.dispatch(closeSign());
|
|
46
|
+
store.dispatch(accID(user.uid));
|
|
47
|
+
store.dispatch(accName(user.displayName || 'John Doe'));
|
|
48
|
+
store.dispatch(accEmail(user.email || 'Nothing'));
|
|
49
|
+
store.dispatch(accImage(user.photoURL || 'images/empty.jpg'));
|
|
50
|
+
store.dispatch(nameAuth(user.displayName || 'John Doe'));
|
|
51
|
+
store.dispatch(iconAuth(user.photoURL || 'images/empty.jpg'));
|
|
52
|
+
if (pendingEmailVerification && !user.emailVerified) {
|
|
53
|
+
sendEmailVerification(user)
|
|
54
|
+
.then(() => {
|
|
55
|
+
console.log("Verification email sent to:");
|
|
56
|
+
pendingEmailVerification = false;
|
|
57
|
+
})
|
|
58
|
+
.catch((error) => {
|
|
59
|
+
console.error("Error sending verification email:", error.message);
|
|
60
|
+
pendingEmailVerification = false;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else if (user.emailVerified) {
|
|
64
|
+
console.log("User's email is already verified:");
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
console.log("User signed in, no email verification pending:");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
console.log('logged out');
|
|
72
|
+
store.dispatch(userAuth(false));
|
|
73
|
+
store.dispatch(accID(''));
|
|
74
|
+
store.dispatch(accName('John Doe'));
|
|
75
|
+
store.dispatch(accEmail('Nothing'));
|
|
76
|
+
store.dispatch(accImage('images/empty.jpg'));
|
|
77
|
+
store.dispatch(nameAuth('John Doe'));
|
|
78
|
+
store.dispatch(iconAuth('images/empty.jpg'));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
export const logOut = async () => { return signOut(auth); };
|
|
82
|
+
export const logAccount = async () => { logEvent(analytics, 'create_account'); };
|
|
83
|
+
export const logAccountDelete = async () => { logEvent(analytics, 'delete_account'); };
|
|
84
|
+
export const deleteDocument = async (collect, item) => {
|
|
85
|
+
await deleteDoc(doc(db, collect, item));
|
|
86
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
2
|
+
frontend: import("./redux/object").frontendAuth;
|
|
3
|
+
drawer: {
|
|
4
|
+
drawer: boolean;
|
|
5
|
+
};
|
|
6
|
+
backend: import("./redux/object").backendAuth;
|
|
7
|
+
}, import("redux").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
|
|
8
|
+
dispatch: import("redux-thunk").ThunkDispatch<{
|
|
9
|
+
frontend: import("./redux/object").frontendAuth;
|
|
10
|
+
drawer: {
|
|
11
|
+
drawer: boolean;
|
|
12
|
+
};
|
|
13
|
+
backend: import("./redux/object").backendAuth;
|
|
14
|
+
}, undefined, import("redux").UnknownAction>;
|
|
15
|
+
}>, import("redux").StoreEnhancer]>>;
|
|
16
|
+
export type AppState = ReturnType<typeof store.getState>;
|
|
17
|
+
export type AppDispatch = typeof store.dispatch;
|
|
18
|
+
export default store;
|
|
19
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;oCAOhB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;AACzD,MAAM,MAAM,WAAW,GAAG,OAAO,KAAK,CAAC,QAAQ,CAAC;AAEhD,eAAe,KAAK,CAAC"}
|
package/deploy/store.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
+
import { userSlice } from './redux/frontend';
|
|
3
|
+
import { drawerSlice } from './redux/drawer';
|
|
4
|
+
import { accountSlice } from './redux/backend';
|
|
5
|
+
export const store = configureStore({
|
|
6
|
+
reducer: {
|
|
7
|
+
frontend: userSlice.reducer,
|
|
8
|
+
drawer: drawerSlice.reducer,
|
|
9
|
+
backend: accountSlice.reducer,
|
|
10
|
+
},
|
|
11
|
+
devTools: true
|
|
12
|
+
});
|
|
13
|
+
export default store;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pwa-auth",
|
|
3
3
|
"author": "Modern Projects <jack.solutionbox@gmail.com>(https://www.contractorscentre.com)",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.5",
|
|
5
5
|
"description": "User Management Component with 3 HTML Tags, and 1 Boilerplate Function to display user icon, sign up, login, log out, change account details, delete account.",
|
|
6
6
|
"homepage": "https://pwa-authentic.firebaseapp.com",
|
|
7
|
-
"main": "
|
|
7
|
+
"main": "pwa-auth.js",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/busynest/user"
|
package/pwa-auth.js
ADDED