pwa-auth 3.2.1 → 3.2.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/CHANGELOG.md +5 -0
- package/README.md +6 -5
- package/base/css/form/button.d.ts +2 -2
- package/base/css/form/button.js +2 -2
- package/base/css/form/input.d.ts +2 -2
- package/base/css/form/input.js +2 -2
- package/base/css/form/label.d.ts +2 -2
- package/base/css/form/label.js +2 -2
- package/base/css/form/list.d.ts +2 -2
- package/base/css/form/list.js +2 -2
- package/base/css/svg.d.ts +3 -3
- package/base/css/svg.js +4 -4
- package/base/css/toggle.d.ts +1 -1
- package/base/css/toggle.js +2 -2
- package/base/export/pwa-auth.d.ts +4 -4
- package/base/export/pwa-auth.js +4 -4
- package/base/firebase/authentication.d.ts +10 -10
- package/base/firebase/authentication.js +10 -10
- package/base/firebase/interface.d.ts +4 -4
- package/base/firebase/interface.js +79 -79
- package/base/firebase/interface.js.map +1 -1
- package/base/redux/backend.d.ts +113 -15
- package/base/redux/backend.js +43 -43
- package/base/redux/backend.js.map +1 -1
- package/base/redux/drawer.d.ts +17 -19
- package/base/redux/drawer.js +21 -21
- package/base/redux/drawer.js.map +1 -1
- package/base/redux/frontend.d.ts +159 -16
- package/base/redux/frontend.js +67 -67
- package/base/redux/frontend.js.map +1 -1
- package/base/redux/object.d.ts +23 -23
- package/base/redux/object.js +1 -1
- package/base/store.d.ts +60 -18
- package/base/store.js +13 -13
- package/base/webcomponents/drawer/css/drawer.d.ts +2 -2
- package/base/webcomponents/drawer/css/drawer.js +2 -2
- package/base/webcomponents/drawer/css/exit.d.ts +2 -2
- package/base/webcomponents/drawer/css/exit.js +2 -2
- package/base/webcomponents/drawer/css/link.d.ts +2 -2
- package/base/webcomponents/drawer/css/link.js +2 -2
- package/base/webcomponents/drawer/css/paragraph.d.ts +2 -2
- package/base/webcomponents/drawer/css/paragraph.js +2 -2
- package/base/webcomponents/drawer/css/toggle.d.ts +2 -2
- package/base/webcomponents/drawer/css/toggle.js +2 -2
- package/base/webcomponents/drawer/drawer.d.ts +57 -36
- package/base/webcomponents/drawer/drawer.js +95 -95
- package/base/webcomponents/drawer/drawer.js.map +1 -1
- package/base/webcomponents/drawer/input/login.d.ts +19 -19
- package/base/webcomponents/drawer/input/login.js +83 -83
- package/base/webcomponents/drawer/input/login.js.map +1 -1
- package/base/webcomponents/drawer/input/sign-up.d.ts +19 -19
- package/base/webcomponents/drawer/input/sign-up.js +90 -90
- package/base/webcomponents/drawer/input/sign-up.js.map +1 -1
- package/base/webcomponents/icon/css/icon.d.ts +1 -1
- package/base/webcomponents/icon/css/icon.js +2 -2
- package/base/webcomponents/icon/icon.d.ts +53 -32
- package/base/webcomponents/icon/icon.js +59 -59
- package/base/webcomponents/icon/icon.js.map +1 -1
- package/base/webcomponents/settings/css/navigation.d.ts +1 -1
- package/base/webcomponents/settings/css/navigation.js +2 -2
- package/base/webcomponents/settings/input/delete.d.ts +54 -33
- package/base/webcomponents/settings/input/delete.js +73 -73
- package/base/webcomponents/settings/input/delete.js.map +1 -1
- package/base/webcomponents/settings/input/email.d.ts +54 -33
- package/base/webcomponents/settings/input/email.js +72 -72
- package/base/webcomponents/settings/input/email.js.map +1 -1
- package/base/webcomponents/settings/input/name.d.ts +53 -32
- package/base/webcomponents/settings/input/name.js +67 -67
- package/base/webcomponents/settings/input/name.js.map +1 -1
- package/base/webcomponents/settings/input/password.d.ts +56 -35
- package/base/webcomponents/settings/input/password.js +97 -97
- package/base/webcomponents/settings/input/password.js.map +1 -1
- package/base/webcomponents/settings/input/uploader.d.ts +57 -36
- package/base/webcomponents/settings/input/uploader.js +150 -150
- package/base/webcomponents/settings/input/uploader.js.map +1 -1
- package/base/webcomponents/settings/settings.d.ts +57 -36
- package/base/webcomponents/settings/settings.js +78 -78
- package/base/webcomponents/settings/settings.js.map +1 -1
- package/package.json +6 -8
- package/source/esm/pwa-auth.js +881 -0
- package/source/esm/pwa-auth.js.map +1 -0
- package/export/auth-helpers.ts +0 -1
- package/export/export/tsconfigs.production.md +0 -53
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -22,14 +22,13 @@ Continue reading to understand how to install the project:
|
|
|
22
22
|
ECMA Script Modules
|
|
23
23
|
```javascript
|
|
24
24
|
import 'pwa-auth';
|
|
25
|
-
import { db, storage, auth, user } from 'pwa-auth
|
|
25
|
+
import { db, storage, auth, user } from 'pwa-auth';
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
Global Scope Management
|
|
29
29
|
```html
|
|
30
30
|
<!-- Optional: Copy the Project Files from 'src' Folder -->
|
|
31
31
|
<script type="module" src="./pwa-auth.js"></script>
|
|
32
|
-
<script type="module" src="./pwa-helpers.js"></script>
|
|
33
32
|
```
|
|
34
33
|
## Library
|
|
35
34
|
- 3 Tag Placement
|
|
@@ -77,9 +76,10 @@ Global Scope Management
|
|
|
77
76
|
|
|
78
77
|
## Boilerplate
|
|
79
78
|
|
|
80
|
-
For simple projects,
|
|
81
|
-
-
|
|
79
|
+
For simple projects, copy project bundle to disk
|
|
80
|
+
- source/esm/
|
|
82
81
|
- pwa-auth.js
|
|
82
|
+
- pwa-auth.js.map
|
|
83
83
|
- pwa-styles.css
|
|
84
84
|
- empty.jpg
|
|
85
85
|
|
|
@@ -116,12 +116,13 @@ For simple projects, you can copy to disk
|
|
|
116
116
|
## Boilerplate
|
|
117
117
|
|
|
118
118
|
### TypeScript Library for Bundlers
|
|
119
|
+
The Start File exports: classes and objects
|
|
119
120
|
```javascript
|
|
120
121
|
import 'pwa-auth';
|
|
121
122
|
// <user-icon subscribe emptyArtwork="./images/empty.jpg"></user-icon>
|
|
122
123
|
// <user-drawer subscribe settingsURL="./settings"></user-drawer>
|
|
123
124
|
// <user-settings emptyArtwork="./images/empty.jpg"></user-settings>
|
|
124
|
-
import { db, storage, auth, user } from 'pwa-auth
|
|
125
|
+
import { db, storage, auth, user } from 'pwa-auth';
|
|
125
126
|
// db - firestore database reference
|
|
126
127
|
// storage - firebase storage reference
|
|
127
128
|
// auth - user object reference
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CSSResult } from "lit";
|
|
2
|
-
export declare const buttonStyle: CSSResult;
|
|
1
|
+
import { CSSResult } from "lit";
|
|
2
|
+
export declare const buttonStyle: CSSResult;
|
package/base/css/form/button.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
1
|
+
import { css } from "lit";
|
|
2
2
|
export const buttonStyle = css `
|
|
3
3
|
|
|
4
4
|
.action-button:focus { outline:0; }
|
|
@@ -51,5 +51,5 @@ export const buttonStyle = css `
|
|
|
51
51
|
cursor: pointer;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
`;
|
|
54
|
+
`;
|
|
55
55
|
//# sourceMappingURL=button.js.map
|
package/base/css/form/input.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CSSResult } from "lit";
|
|
2
|
-
export declare const inputStyle: CSSResult;
|
|
1
|
+
import { CSSResult } from "lit";
|
|
2
|
+
export declare const inputStyle: CSSResult;
|
package/base/css/form/input.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
1
|
+
import { css } from "lit";
|
|
2
2
|
export const inputStyle = css `
|
|
3
3
|
|
|
4
4
|
input[type=text],
|
|
@@ -21,5 +21,5 @@ export const inputStyle = css `
|
|
|
21
21
|
|
|
22
22
|
input.invalid { background-color: #ffdddd; }
|
|
23
23
|
|
|
24
|
-
`;
|
|
24
|
+
`;
|
|
25
25
|
//# sourceMappingURL=input.js.map
|
package/base/css/form/label.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CSSResult } from "lit";
|
|
2
|
-
export declare const labelStyle: CSSResult;
|
|
1
|
+
import { CSSResult } from "lit";
|
|
2
|
+
export declare const labelStyle: CSSResult;
|
package/base/css/form/label.js
CHANGED
package/base/css/form/list.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CSSResult } from "lit";
|
|
2
|
-
export declare const listStyle: CSSResult;
|
|
1
|
+
import { CSSResult } from "lit";
|
|
2
|
+
export declare const listStyle: CSSResult;
|
package/base/css/form/list.js
CHANGED
package/base/css/svg.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const faceIcon: import("lit-html").TemplateResult<1>;
|
|
2
|
-
export declare const settings: import("lit-html").TemplateResult<1>;
|
|
3
|
-
export declare const close: import("lit-html").TemplateResult<1>;
|
|
1
|
+
export declare const faceIcon: import("lit-html").TemplateResult<1>;
|
|
2
|
+
export declare const settings: import("lit-html").TemplateResult<1>;
|
|
3
|
+
export declare const close: import("lit-html").TemplateResult<1>;
|
package/base/css/svg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { html } from "lit";
|
|
2
|
-
export const faceIcon = html `<svg viewBox="0 0 24 24" height="34px" width="34px"><path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z"></path></svg>`;
|
|
3
|
-
export const settings = html `<svg viewBox="0 0 24 24"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"></path></svg>`;
|
|
4
|
-
export const close = html `<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>`;
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
export const faceIcon = html `<svg viewBox="0 0 24 24" height="34px" width="34px"><path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z"></path></svg>`;
|
|
3
|
+
export const settings = html `<svg viewBox="0 0 24 24"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"></path></svg>`;
|
|
4
|
+
export const close = html `<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>`;
|
|
5
5
|
//# sourceMappingURL=svg.js.map
|
package/base/css/toggle.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const show: import("lit").CSSResult;
|
|
1
|
+
export declare const show: import("lit").CSSResult;
|
package/base/css/toggle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { UserDrawer } from '../webcomponents/drawer/drawer';
|
|
2
|
-
export { UserSettings } from '../webcomponents/settings/settings';
|
|
3
|
-
export { UserIcon } from '../webcomponents/icon/icon';
|
|
4
|
-
export { firebaseConfig, application, db, storage, auth, user } from '../firebase/authentication';
|
|
1
|
+
export { UserDrawer } from '../webcomponents/drawer/drawer';
|
|
2
|
+
export { UserSettings } from '../webcomponents/settings/settings';
|
|
3
|
+
export { UserIcon } from '../webcomponents/icon/icon';
|
|
4
|
+
export { firebaseConfig, application, db, storage, auth, user } from '../firebase/authentication';
|
package/base/export/pwa-auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { UserDrawer } from '../webcomponents/drawer/drawer';
|
|
2
|
-
export { UserSettings } from '../webcomponents/settings/settings';
|
|
3
|
-
export { UserIcon } from '../webcomponents/icon/icon';
|
|
4
|
-
export { firebaseConfig, application, db, storage, auth, user } from '../firebase/authentication';
|
|
1
|
+
export { UserDrawer } from '../webcomponents/drawer/drawer';
|
|
2
|
+
export { UserSettings } from '../webcomponents/settings/settings';
|
|
3
|
+
export { UserIcon } from '../webcomponents/icon/icon';
|
|
4
|
+
export { firebaseConfig, application, db, storage, auth, user } from '../firebase/authentication';
|
|
5
5
|
//# sourceMappingURL=pwa-auth.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FirebaseApp } from 'firebase/app';
|
|
2
|
-
import { Firestore } from "firebase/firestore";
|
|
3
|
-
import { FirebaseStorage } from "@firebase/storage";
|
|
4
|
-
import { User, Auth } from 'firebase/auth';
|
|
5
|
-
export declare const firebaseConfig: any;
|
|
6
|
-
export declare const application: FirebaseApp;
|
|
7
|
-
export declare const db: Firestore;
|
|
8
|
-
export declare const storage: FirebaseStorage;
|
|
9
|
-
export declare const auth: Auth;
|
|
10
|
-
export declare const user: User | null;
|
|
1
|
+
import { FirebaseApp } from 'firebase/app';
|
|
2
|
+
import { Firestore } from "firebase/firestore";
|
|
3
|
+
import { FirebaseStorage } from "@firebase/storage";
|
|
4
|
+
import { User, Auth } from 'firebase/auth';
|
|
5
|
+
export declare const firebaseConfig: any;
|
|
6
|
+
export declare const application: FirebaseApp;
|
|
7
|
+
export declare const db: Firestore;
|
|
8
|
+
export declare const storage: FirebaseStorage;
|
|
9
|
+
export declare const auth: Auth;
|
|
10
|
+
export declare const user: User | null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { initializeApp } from 'firebase/app';
|
|
2
|
-
import { getFirestore } from "firebase/firestore";
|
|
3
|
-
import { getStorage } from "@firebase/storage";
|
|
4
|
-
import { getAuth } from 'firebase/auth';
|
|
5
|
-
export const firebaseConfig = JSON.parse(process.env.FIREBASE_CONFIG || "{}");
|
|
6
|
-
export const application = initializeApp(firebaseConfig);
|
|
7
|
-
export const db = getFirestore(application);
|
|
8
|
-
export const storage = getStorage(application);
|
|
9
|
-
export const auth = getAuth(application);
|
|
10
|
-
export const user = auth.currentUser;
|
|
1
|
+
import { initializeApp } from 'firebase/app';
|
|
2
|
+
import { getFirestore } from "firebase/firestore";
|
|
3
|
+
import { getStorage } from "@firebase/storage";
|
|
4
|
+
import { getAuth } from 'firebase/auth';
|
|
5
|
+
export const firebaseConfig = JSON.parse(process.env.FIREBASE_CONFIG || "{}");
|
|
6
|
+
export const application = initializeApp(firebaseConfig);
|
|
7
|
+
export const db = getFirestore(application);
|
|
8
|
+
export const storage = getStorage(application);
|
|
9
|
+
export const auth = getAuth(application);
|
|
10
|
+
export const user = auth.currentUser;
|
|
11
11
|
//# sourceMappingURL=authentication.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const logOut: () => Promise<void>;
|
|
2
|
-
export declare const logAccount: () => Promise<void>;
|
|
3
|
-
export declare const logAccountDelete: () => Promise<void>;
|
|
4
|
-
export declare const deleteDocument: (collect: string, item: string) => Promise<void>;
|
|
1
|
+
export declare const logOut: () => Promise<void>;
|
|
2
|
+
export declare const logAccount: () => Promise<void>;
|
|
3
|
+
export declare const logAccountDelete: () => Promise<void>;
|
|
4
|
+
export declare const deleteDocument: (collect: string, item: string) => Promise<void>;
|
|
@@ -1,80 +1,80 @@
|
|
|
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 { getAuth, onAuthStateChanged, sendEmailVerification, signOut } from 'firebase/auth';
|
|
5
|
-
import { doc, deleteDoc } from "firebase/firestore";
|
|
6
|
-
import { getAnalytics, logEvent } from "firebase/analytics";
|
|
7
|
-
import { isSupported } from "firebase/messaging";
|
|
8
|
-
import { application, auth, db } from './authentication';
|
|
9
|
-
getAuth().useDeviceLanguage();
|
|
10
|
-
let analytics;
|
|
11
|
-
(async () => {
|
|
12
|
-
if (await isSupported()) {
|
|
13
|
-
console.log('Firebase Analytics Supported');
|
|
14
|
-
analytics = getAnalytics(application);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
console.log("Firebase Analytics is not supported in this environment.");
|
|
18
|
-
}
|
|
19
|
-
})();
|
|
20
|
-
if ('serviceWorker' in navigator) {
|
|
21
|
-
console.log('Service Worker is supported');
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
console.log('Service Worker is not supported');
|
|
25
|
-
}
|
|
26
|
-
if ('PushManager' in window) {
|
|
27
|
-
console.log('Push API is supported');
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
console.log('Push API is not supported');
|
|
31
|
-
}
|
|
32
|
-
let pendingEmailVerification = false;
|
|
33
|
-
window.addEventListener("userEmailChanged", () => {
|
|
34
|
-
pendingEmailVerification = true;
|
|
35
|
-
});
|
|
36
|
-
onAuthStateChanged(auth, (user) => {
|
|
37
|
-
if (user) {
|
|
38
|
-
store.dispatch(userAuth(true));
|
|
39
|
-
store.dispatch(closeSign());
|
|
40
|
-
store.dispatch(accID(user.uid));
|
|
41
|
-
store.dispatch(accName(user.displayName || 'John Doe'));
|
|
42
|
-
store.dispatch(accEmail(user.email || ''));
|
|
43
|
-
store.dispatch(accImage(user.photoURL || ''));
|
|
44
|
-
store.dispatch(nameAuth(user.displayName || 'John Doe'));
|
|
45
|
-
store.dispatch(iconAuth(user.photoURL || ''));
|
|
46
|
-
if (pendingEmailVerification && !user.emailVerified) {
|
|
47
|
-
sendEmailVerification(user)
|
|
48
|
-
.then(() => {
|
|
49
|
-
console.log("Verification email sent to:");
|
|
50
|
-
pendingEmailVerification = false;
|
|
51
|
-
})
|
|
52
|
-
.catch((error) => {
|
|
53
|
-
console.error("Error sending verification email:", error.message);
|
|
54
|
-
pendingEmailVerification = false;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
else if (user.emailVerified) {
|
|
58
|
-
console.log("User's email is already verified:");
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
console.log("User signed in, no email verification pending:");
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
store.dispatch(userAuth(false));
|
|
66
|
-
store.dispatch(accID(''));
|
|
67
|
-
store.dispatch(accName('John Doe'));
|
|
68
|
-
store.dispatch(accEmail(''));
|
|
69
|
-
store.dispatch(accImage(''));
|
|
70
|
-
store.dispatch(nameAuth('John Doe'));
|
|
71
|
-
store.dispatch(iconAuth(''));
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
export const logOut = async () => { return signOut(auth); };
|
|
75
|
-
export const logAccount = async () => { logEvent(analytics, 'create_account'); };
|
|
76
|
-
export const logAccountDelete = async () => { logEvent(analytics, 'delete_account'); };
|
|
77
|
-
export const deleteDocument = async (collect, item) => {
|
|
78
|
-
await deleteDoc(doc(db, collect, item));
|
|
79
|
-
};
|
|
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 { getAuth, onAuthStateChanged, sendEmailVerification, signOut } from 'firebase/auth';
|
|
5
|
+
import { doc, deleteDoc } from "firebase/firestore";
|
|
6
|
+
import { getAnalytics, logEvent } from "firebase/analytics";
|
|
7
|
+
import { isSupported } from "firebase/messaging";
|
|
8
|
+
import { application, auth, db } from './authentication';
|
|
9
|
+
getAuth().useDeviceLanguage();
|
|
10
|
+
let analytics;
|
|
11
|
+
(async () => {
|
|
12
|
+
if (await isSupported()) {
|
|
13
|
+
console.log('Firebase Analytics Supported');
|
|
14
|
+
analytics = getAnalytics(application);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
console.log("Firebase Analytics is not supported in this environment.");
|
|
18
|
+
}
|
|
19
|
+
})();
|
|
20
|
+
if ('serviceWorker' in navigator) {
|
|
21
|
+
console.log('Service Worker is supported');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.log('Service Worker is not supported');
|
|
25
|
+
}
|
|
26
|
+
if ('PushManager' in window) {
|
|
27
|
+
console.log('Push API is supported');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.log('Push API is not supported');
|
|
31
|
+
}
|
|
32
|
+
let pendingEmailVerification = false;
|
|
33
|
+
window.addEventListener("userEmailChanged", () => {
|
|
34
|
+
pendingEmailVerification = true;
|
|
35
|
+
});
|
|
36
|
+
onAuthStateChanged(auth, (user) => {
|
|
37
|
+
if (user) {
|
|
38
|
+
store.dispatch(userAuth(true));
|
|
39
|
+
store.dispatch(closeSign());
|
|
40
|
+
store.dispatch(accID(user.uid));
|
|
41
|
+
store.dispatch(accName(user.displayName || 'John Doe'));
|
|
42
|
+
store.dispatch(accEmail(user.email || ''));
|
|
43
|
+
store.dispatch(accImage(user.photoURL || ''));
|
|
44
|
+
store.dispatch(nameAuth(user.displayName || 'John Doe'));
|
|
45
|
+
store.dispatch(iconAuth(user.photoURL || ''));
|
|
46
|
+
if (pendingEmailVerification && !user.emailVerified) {
|
|
47
|
+
sendEmailVerification(user)
|
|
48
|
+
.then(() => {
|
|
49
|
+
console.log("Verification email sent to:");
|
|
50
|
+
pendingEmailVerification = false;
|
|
51
|
+
})
|
|
52
|
+
.catch((error) => {
|
|
53
|
+
console.error("Error sending verification email:", error.message);
|
|
54
|
+
pendingEmailVerification = false;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else if (user.emailVerified) {
|
|
58
|
+
console.log("User's email is already verified:");
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.log("User signed in, no email verification pending:");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
store.dispatch(userAuth(false));
|
|
66
|
+
store.dispatch(accID(''));
|
|
67
|
+
store.dispatch(accName('John Doe'));
|
|
68
|
+
store.dispatch(accEmail(''));
|
|
69
|
+
store.dispatch(accImage(''));
|
|
70
|
+
store.dispatch(nameAuth('John Doe'));
|
|
71
|
+
store.dispatch(iconAuth(''));
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
export const logOut = async () => { return signOut(auth); };
|
|
75
|
+
export const logAccount = async () => { logEvent(analytics, 'create_account'); };
|
|
76
|
+
export const logAccountDelete = async () => { logEvent(analytics, 'delete_account'); };
|
|
77
|
+
export const deleteDocument = async (collect, item) => {
|
|
78
|
+
await deleteDoc(doc(db, collect, item));
|
|
79
|
+
};
|
|
80
80
|
//# sourceMappingURL=interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../typescript/firebase/interface.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGtE,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG5F,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAa,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAGxD,OAAO,EAAE,CAAC,iBAAiB,EAAE,CAAC;AAS9B,IAAI,SA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,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,MAAM,CAAC,MAAM,gBAAgB,GAAK,KAAK,IAAI,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,MAAM,CAAC,MAAM,cAAc,GAAO,KAAK,EAAE,OAAc,EAAE,IAAW,EAAE,EAAE;IAEtE,MAAM,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AAE1C,CAAC,CAAC"}
|
package/base/redux/backend.d.ts
CHANGED
|
@@ -1,15 +1,113 @@
|
|
|
1
|
-
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
export declare const accountSlice: import("@reduxjs/toolkit").Slice<{
|
|
3
|
+
verified: boolean;
|
|
4
|
+
anon: boolean;
|
|
5
|
+
userId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
email: string;
|
|
8
|
+
photoURL: string;
|
|
9
|
+
phone: string;
|
|
10
|
+
msgToken: string;
|
|
11
|
+
}, {
|
|
12
|
+
accVerified: (state: import("immer").WritableDraft<{
|
|
13
|
+
verified: boolean;
|
|
14
|
+
anon: boolean;
|
|
15
|
+
userId: string;
|
|
16
|
+
name: string;
|
|
17
|
+
email: string;
|
|
18
|
+
photoURL: string;
|
|
19
|
+
phone: string;
|
|
20
|
+
msgToken: string;
|
|
21
|
+
}>, action: PayloadAction<boolean>) => void;
|
|
22
|
+
accAnon: (state: import("immer").WritableDraft<{
|
|
23
|
+
verified: boolean;
|
|
24
|
+
anon: boolean;
|
|
25
|
+
userId: string;
|
|
26
|
+
name: string;
|
|
27
|
+
email: string;
|
|
28
|
+
photoURL: string;
|
|
29
|
+
phone: string;
|
|
30
|
+
msgToken: string;
|
|
31
|
+
}>, action: PayloadAction<boolean>) => void;
|
|
32
|
+
accID: (state: import("immer").WritableDraft<{
|
|
33
|
+
verified: boolean;
|
|
34
|
+
anon: boolean;
|
|
35
|
+
userId: string;
|
|
36
|
+
name: string;
|
|
37
|
+
email: string;
|
|
38
|
+
photoURL: string;
|
|
39
|
+
phone: string;
|
|
40
|
+
msgToken: string;
|
|
41
|
+
}>, action: PayloadAction<string>) => void;
|
|
42
|
+
accName: (state: import("immer").WritableDraft<{
|
|
43
|
+
verified: boolean;
|
|
44
|
+
anon: boolean;
|
|
45
|
+
userId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
email: string;
|
|
48
|
+
photoURL: string;
|
|
49
|
+
phone: string;
|
|
50
|
+
msgToken: string;
|
|
51
|
+
}>, action: PayloadAction<string>) => void;
|
|
52
|
+
accPhone: (state: import("immer").WritableDraft<{
|
|
53
|
+
verified: boolean;
|
|
54
|
+
anon: boolean;
|
|
55
|
+
userId: string;
|
|
56
|
+
name: string;
|
|
57
|
+
email: string;
|
|
58
|
+
photoURL: string;
|
|
59
|
+
phone: string;
|
|
60
|
+
msgToken: string;
|
|
61
|
+
}>, action: PayloadAction<string>) => void;
|
|
62
|
+
accEmail: (state: import("immer").WritableDraft<{
|
|
63
|
+
verified: boolean;
|
|
64
|
+
anon: boolean;
|
|
65
|
+
userId: string;
|
|
66
|
+
name: string;
|
|
67
|
+
email: string;
|
|
68
|
+
photoURL: string;
|
|
69
|
+
phone: string;
|
|
70
|
+
msgToken: string;
|
|
71
|
+
}>, action: PayloadAction<string>) => void;
|
|
72
|
+
accImage: (state: import("immer").WritableDraft<{
|
|
73
|
+
verified: boolean;
|
|
74
|
+
anon: boolean;
|
|
75
|
+
userId: string;
|
|
76
|
+
name: string;
|
|
77
|
+
email: string;
|
|
78
|
+
photoURL: string;
|
|
79
|
+
phone: string;
|
|
80
|
+
msgToken: string;
|
|
81
|
+
}>, action: PayloadAction<string>) => void;
|
|
82
|
+
messageId: (state: import("immer").WritableDraft<{
|
|
83
|
+
verified: boolean;
|
|
84
|
+
anon: boolean;
|
|
85
|
+
userId: string;
|
|
86
|
+
name: string;
|
|
87
|
+
email: string;
|
|
88
|
+
photoURL: string;
|
|
89
|
+
phone: string;
|
|
90
|
+
msgToken: string;
|
|
91
|
+
}>, action: PayloadAction<string>) => void;
|
|
92
|
+
}, "backend", "backend", import("@reduxjs/toolkit").SliceSelectors<{
|
|
93
|
+
verified: boolean;
|
|
94
|
+
anon: boolean;
|
|
95
|
+
userId: string;
|
|
96
|
+
name: string;
|
|
97
|
+
email: string;
|
|
98
|
+
photoURL: string;
|
|
99
|
+
phone: string;
|
|
100
|
+
msgToken: string;
|
|
101
|
+
}>>;
|
|
102
|
+
export declare const accVerified: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "backend/accVerified">, accID: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "backend/accID">, accName: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "backend/accName">, accPhone: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "backend/accPhone">, accEmail: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "backend/accEmail">, accImage: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "backend/accImage">, accAnon: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "backend/accAnon">, messageId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "backend/messageId">;
|
|
103
|
+
declare const _default: import("redux").Reducer<{
|
|
104
|
+
verified: boolean;
|
|
105
|
+
anon: boolean;
|
|
106
|
+
userId: string;
|
|
107
|
+
name: string;
|
|
108
|
+
email: string;
|
|
109
|
+
photoURL: string;
|
|
110
|
+
phone: string;
|
|
111
|
+
msgToken: string;
|
|
112
|
+
}>;
|
|
113
|
+
export default _default;
|