pwa-auth 1.1.5 → 1.1.9

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +5 -5
  3. package/demo/index.html +2 -4
  4. package/demo/styles.css +8 -3
  5. package/deploy/css/form/button.js +1 -1
  6. package/deploy/css/form/input.js +1 -1
  7. package/deploy/css/form/label.d.ts.map +1 -1
  8. package/deploy/css/form/label.js +2 -1
  9. package/deploy/custom-elements/drawer/drawer.d.ts +4 -3
  10. package/deploy/custom-elements/drawer/drawer.d.ts.map +1 -1
  11. package/deploy/custom-elements/drawer/drawer.js +46 -13
  12. package/deploy/custom-elements/icon/css/icon.js +1 -1
  13. package/deploy/custom-elements/icon/icon.d.ts +1 -0
  14. package/deploy/custom-elements/icon/icon.d.ts.map +1 -1
  15. package/deploy/custom-elements/icon/icon.js +6 -2
  16. package/deploy/custom-elements/settings/css/navigation.js +2 -2
  17. package/deploy/custom-elements/settings/input/delete.d.ts +1 -0
  18. package/deploy/custom-elements/settings/input/delete.d.ts.map +1 -1
  19. package/deploy/custom-elements/settings/input/delete.js +10 -1
  20. package/deploy/custom-elements/settings/input/name.js +1 -1
  21. package/deploy/custom-elements/settings/input/uploader.d.ts +4 -0
  22. package/deploy/custom-elements/settings/input/uploader.d.ts.map +1 -1
  23. package/deploy/custom-elements/settings/input/uploader.js +41 -1
  24. package/deploy/custom-elements/settings/settings.d.ts.map +1 -1
  25. package/deploy/custom-elements/settings/settings.js +0 -1
  26. package/npm/pwa-auth.js +306 -0
  27. package/package.json +2 -2
  28. package/deploy/custom-elements/settings/css/uploader.d.ts +0 -2
  29. package/deploy/custom-elements/settings/css/uploader.d.ts.map +0 -1
  30. package/deploy/custom-elements/settings/css/uploader.js +0 -40
package/CHANGELOG.md CHANGED
@@ -12,6 +12,11 @@ Removed - for now removed features.
12
12
  Fixed - for any bug fixes.
13
13
  Security - in case of vulnerabilities.
14
14
 
15
+ # [1.1.6] - 2025-08-25
16
+
17
+ ## Changed
18
+ - Drawer - should be the custome element itself, not internal wrapper
19
+
15
20
  # [1.0.8] - 2025-08-23
16
21
 
17
22
  ## Changed
package/README.md CHANGED
@@ -9,7 +9,6 @@ This library provides Identity Access Managementy to securely store user's data.
9
9
 
10
10
  ## Module JavaScript
11
11
  ```javascript
12
- /* To do: Bare Module Specifiers - Currently: Absolute / Relative */
13
12
  import 'pwa-auth';
14
13
  ```
15
14
 
@@ -58,12 +57,13 @@ import 'pwa-auth';
58
57
  # Website Setup:
59
58
  ```html
60
59
  <header>
61
- <user-icon>Subscribe</user-icon>
60
+ <!-- Indicate the 'register' boolean for 'subscribe state' -->
61
+ <!-- else 'login state' -->
62
+ <user-icon register></user-icon>
62
63
  </header>
63
64
 
64
- <user-drawer>
65
- <p><a href="/settings">Settings</a></p>
66
- </user-drawer>
65
+ <!-- Indicate where the <pwa-settings> Tag will be Paged-->
66
+ <user-drawer url="/settings"></user-drawer>
67
67
 
68
68
  <main>
69
69
  <user-settings></user-settings>
package/demo/index.html CHANGED
@@ -42,12 +42,10 @@
42
42
  <body>
43
43
 
44
44
  <!-- Button -->
45
- <header><user-icon settingsURL="/">Subscribe</user-icon></header>
45
+ <header><user-icon register></user-icon></header>
46
46
 
47
47
  <!-- Drawer -->
48
- <user-drawer>
49
- <p><a href="/settings">Settings</a></p>
50
- </user-drawer>
48
+ <user-drawer url="/demo/settings"></user-drawer>
51
49
 
52
50
  <!-- Settings -->
53
51
  <main><user-settings></user-settings></main>
package/demo/styles.css CHANGED
@@ -19,17 +19,22 @@ body {
19
19
 
20
20
  body {
21
21
  display: grid;
22
+ grid-gap: 16px;
22
23
  grid-template-areas:
23
24
  "head"
24
- "drawer"
25
25
  "main";
26
- grid-template-rows: auto auto 1fr;
26
+ grid-template-rows: auto 1fr;
27
27
  }
28
28
 
29
29
  header { grid-area: head; }
30
- user-drawer { grid-area: drawer; }
31
30
  main { grid-area: main; }
32
31
 
32
+ main {
33
+ border: 2px solid black;
34
+ border-radius: 6px;
35
+ overflow: hidden;
36
+ }
37
+
33
38
  body {
34
39
  background: linear-gradient(124deg, #e8891d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
35
40
  background-size: 1800%;
@@ -7,7 +7,7 @@ export const buttonStyle = css `
7
7
  display: inline-block;
8
8
  box-sizing: border-box;
9
9
  white-space: nowrap;
10
- margin: 10px 3px 10px auto;
10
+ margin: 16px 16px 16px auto;
11
11
  font-weight: 400;
12
12
  text-align: center;
13
13
  vertical-align: middle;
@@ -9,7 +9,7 @@ export const inputStyle = css `
9
9
  -webkit-box-sizing: border-box;
10
10
  height: 50px;
11
11
  text-align: left;
12
- margin: 0 3px 0 3px;
12
+ margin: 0 16px 0 16px;
13
13
  padding: 8px 16px;
14
14
  background-color: var(--pwa_input_background);
15
15
  border: 0;
@@ -1 +1 @@
1
- {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/css/form/label.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC,eAAO,MAAM,UAAU,EAAG,SAqBzB,CAAC"}
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/css/form/label.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC,eAAO,MAAM,UAAU,EAAG,SAsBzB,CAAC"}
@@ -11,7 +11,8 @@ export const labelStyle = css `
11
11
  margin: auto;
12
12
  margin-bottom: 0;
13
13
  font-weight: bold;
14
- line-height: 36px;
14
+ line-height: 36px;
15
+ padding: 0 16px;
15
16
  }
16
17
 
17
18
  @media (max-width: 460px) {
@@ -1,4 +1,4 @@
1
- import { LitElement } from 'lit';
1
+ import { CSSResultArray, LitElement } from 'lit';
2
2
  import { AppState } from '../../store';
3
3
  import './input/login';
4
4
  import './input/sign-up';
@@ -16,14 +16,15 @@ declare const UserDrawer_base: (new (...args: any[]) => {
16
16
  readonly isConnected: boolean;
17
17
  }) & typeof LitElement;
18
18
  export declare class UserDrawer extends UserDrawer_base {
19
+ private url;
20
+ drawer: boolean;
19
21
  private _name;
20
- private _subscribe;
21
22
  private _log;
22
23
  private _sign;
23
24
  constructor();
24
25
  protected firstUpdated(): void;
25
26
  stateChanged(state: AppState): void;
26
- static get styles(): import("lit").CSSResult[];
27
+ static get styles(): CSSResultArray;
27
28
  protected render(): import("lit-html").TemplateResult<1>;
28
29
  }
29
30
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/custom-elements/drawer/drawer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAoB,KAAK,CAAC;AAGrD,OAAO,EAAS,QAAQ,EAAE,MAAqB,aAAa,CAAC;AAc7D,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;;;;;;;;;;;;;;AAEzB,qBACa,UAAW,SAAQ,eAA0B;IAE/C,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,UAAU,CAAW;IAC7B,OAAO,CAAC,IAAI,CAAiB;IAC7B,OAAO,CAAC,KAAK,CAAgB;;IAItC,SAAS,CAAC,YAAY;IAMtB,YAAY,CAAC,KAAK,EAAE,QAAQ;IAO5B,MAAM,KAAK,MAAM,8BAQd;IAEH,SAAS,CAAC,MAAM;CAgDjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC3B,aAAa,EAAE,UAAU,CAAC;KAC7B;CACF"}
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/custom-elements/drawer/drawer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,MAAoB,KAAK,CAAC;AAG1E,OAAO,EAAS,QAAQ,EAAE,MAAqB,aAAa,CAAC;AAc7D,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;;;;;;;;;;;;;;AAEzB,qBACa,UAAW,SAAQ,eAA0B;IAGf,OAAO,CAAC,GAAG,CAAM;IAGO,MAAM,UAAS;IAEvE,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,IAAI,CAAiB;IAC7B,OAAO,CAAC,KAAK,CAAgB;;IAItC,SAAS,CAAC,YAAY;IAatB,YAAY,CAAC,KAAK,EAAE,QAAQ;IAO5B,MAAM,KAAK,MAAM,IAAI,cAAc,CA+BhC;IAEH,SAAS,CAAC,MAAM;CAgDjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC3B,aAAa,EAAE,UAAU,CAAC;KAC7B;CACF"}
@@ -4,8 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { html, LitElement } from 'lit';
8
- import { customElement, state } from 'lit/decorators.js';
7
+ import { css, html, LitElement } from 'lit';
8
+ import { customElement, property, state } from 'lit/decorators.js';
9
9
  import { connect } from 'pwa-helpers/connect-mixin';
10
10
  import { store } from '../../store';
11
11
  import { close } from '../../css/svg';
@@ -23,18 +23,26 @@ import './input/sign-up';
23
23
  let UserDrawer = class UserDrawer extends connect(store)(LitElement) {
24
24
  constructor() {
25
25
  super();
26
+ this.url = '';
27
+ this.drawer = false;
26
28
  this._name = "";
27
- this._subscribe = false;
28
29
  this._log = false;
29
30
  this._sign = false;
30
31
  }
31
32
  firstUpdated() {
32
- this.shadowRoot.querySelector('.close').addEventListener('click', () => { store.dispatch(toggleSign()); });
33
- this.shadowRoot.querySelector('.leave').addEventListener('click', () => { logOut(); });
33
+ this.shadowRoot.querySelector('.close').addEventListener('click', () => {
34
+ store.dispatch(toggleSign());
35
+ });
36
+ this.shadowRoot.querySelector('.leave').addEventListener('click', () => {
37
+ if (this._log) {
38
+ logOut();
39
+ }
40
+ store.dispatch(toggleSign());
41
+ });
34
42
  }
35
43
  stateChanged(state) {
36
44
  this._name = state.backend.name;
37
- this._subscribe = state.frontend.drawer;
45
+ this.drawer = state.frontend.drawer;
38
46
  this._log = state.frontend.login;
39
47
  this._sign = state.frontend.register;
40
48
  }
@@ -46,7 +54,29 @@ let UserDrawer = class UserDrawer extends connect(store)(LitElement) {
46
54
  exitStyle,
47
55
  linkStyle,
48
56
  lineStyle,
49
- listStyle
57
+ listStyle,
58
+ css `
59
+
60
+ :host {
61
+ position: fixed;
62
+ top: 0;
63
+ left: 0;
64
+ right: 0;
65
+ visibility: hidden;
66
+ will-change: transform;
67
+ transform: translate3d(0, -150%, 0);
68
+ transition-property: visibility, transform;
69
+ /*transition-duration: 1.4s;*/
70
+ display: block;
71
+ }
72
+
73
+ :host([drawer]) {
74
+ transition-duration: 1.4s;
75
+ visibility: visible;
76
+ transform: translate3d(0, 0, 0);
77
+ }
78
+
79
+ `
50
80
  ];
51
81
  }
52
82
  ;
@@ -55,8 +85,8 @@ let UserDrawer = class UserDrawer extends connect(store)(LitElement) {
55
85
 
56
86
  <!-- Drawer Wrapper -->
57
87
  <div
58
- class="visibility userDrawer"
59
- ?on="${this._subscribe === true}">
88
+ class=" userDrawer"
89
+ ?on="${this.drawer === true}">
60
90
 
61
91
  <!-- Exit Button -->
62
92
  <div class="exit">
@@ -87,7 +117,7 @@ let UserDrawer = class UserDrawer extends connect(store)(LitElement) {
87
117
  class="spec setLog"
88
118
  ?on="${this._log === true}">
89
119
 
90
- <slot></slot>
120
+ <p><a href="${this.url}">Settings</a></p>
91
121
 
92
122
  <p><a class="leave" aria-label="log out">log out</a></p>
93
123
 
@@ -99,11 +129,14 @@ let UserDrawer = class UserDrawer extends connect(store)(LitElement) {
99
129
  }
100
130
  };
101
131
  __decorate([
102
- state()
103
- ], UserDrawer.prototype, "_name", void 0);
132
+ property({ type: String, reflect: true })
133
+ ], UserDrawer.prototype, "url", void 0);
134
+ __decorate([
135
+ property({ type: Boolean, attribute: true, reflect: true })
136
+ ], UserDrawer.prototype, "drawer", void 0);
104
137
  __decorate([
105
138
  state()
106
- ], UserDrawer.prototype, "_subscribe", void 0);
139
+ ], UserDrawer.prototype, "_name", void 0);
107
140
  __decorate([
108
141
  state()
109
142
  ], UserDrawer.prototype, "_log", void 0);
@@ -9,7 +9,6 @@ export const iconStyles = css `
9
9
 
10
10
  /* Shared Styles */
11
11
  .icon, .login {
12
- height: 40px;
13
12
  cursor: pointer;
14
13
  margin: auto;
15
14
  overflow: hidden;
@@ -25,6 +24,7 @@ export const iconStyles = css `
25
24
 
26
25
  /* The Icon Button */
27
26
  .icon {
27
+ height: 40px;
28
28
  width: 40px;
29
29
 
30
30
  border-radius: 50%;
@@ -14,6 +14,7 @@ declare const UserIcon_base: (new (...args: any[]) => {
14
14
  readonly isConnected: boolean;
15
15
  }) & typeof LitElement;
16
16
  export declare class UserIcon extends UserIcon_base {
17
+ register: boolean;
17
18
  private _user;
18
19
  private _photoURL;
19
20
  constructor();
@@ -1 +1 @@
1
- {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/custom-elements/icon/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,MAAwB,KAAK,CAAC;AAG9E,OAAO,EAAS,QAAQ,EAAE,MAAyB,aAAa,CAAC;;;;;;;;;;;;;;AAKjE,qBACa,QAAS,SAAQ,aAA0B;IAE7C,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAM;;IAKhC,SAAS,CAAC,YAAY;IAOtB,YAAY,CAAC,KAAK,EAAE,QAAQ;IAM5B,MAAM,KAAK,MAAM,IAAG,cAAc,CAM3B;IAEP,SAAS,CAAC,MAAM;CAwBjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC3B,WAAW,EAAE,QAAQ,CAAC;KACzB;CACF"}
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/custom-elements/icon/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,MAAwB,KAAK,CAAC;AAG9E,OAAO,EAAS,QAAQ,EAAE,MAAyB,aAAa,CAAC;;;;;;;;;;;;;;AAKjE,qBACa,QAAS,SAAQ,aAA0B;IAGL,QAAQ,UAAS;IACzD,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAM;;IAKhC,SAAS,CAAC,YAAY;IAOtB,YAAY,CAAC,KAAK,EAAE,QAAQ;IAM5B,MAAM,KAAK,MAAM,IAAG,cAAc,CAM3B;IAEP,SAAS,CAAC,MAAM;CAwBjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC3B,WAAW,EAAE,QAAQ,CAAC;KACzB;CACF"}
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { css, html, LitElement } from 'lit';
8
- import { customElement, state } from 'lit/decorators.js';
8
+ import { customElement, property, state } from 'lit/decorators.js';
9
9
  import { connect } from 'pwa-helpers/connect-mixin.js';
10
10
  import { store } from '../../store';
11
11
  import { iconStyles } from './css/icon';
@@ -13,6 +13,7 @@ import { toggleSign } from '../../redux/frontend';
13
13
  let UserIcon = class UserIcon extends connect(store)(LitElement) {
14
14
  constructor() {
15
15
  super();
16
+ this.register = false;
16
17
  this._user = false;
17
18
  this._photoURL = '';
18
19
  }
@@ -54,13 +55,16 @@ let UserIcon = class UserIcon extends connect(store)(LitElement) {
54
55
  width = "38px"
55
56
  src = "${this._photoURL}">
56
57
  <!-- </div> -->
57
- ` : html `<slot></slot>`}
58
+ ` : this.register ? 'Subscribe' : 'Login'}
58
59
 
59
60
  </button>
60
61
 
61
62
  `;
62
63
  }
63
64
  };
65
+ __decorate([
66
+ property({ type: Boolean, reflect: true })
67
+ ], UserIcon.prototype, "register", void 0);
64
68
  __decorate([
65
69
  state()
66
70
  ], UserIcon.prototype, "_user", void 0);
@@ -47,13 +47,13 @@ export const navigation = css `
47
47
 
48
48
  }
49
49
 
50
- /* Navigation Button - Media Text Justification */
50
+ /* Navigation Button - Media Text Justification
51
51
  @media (max-width: 460px) {
52
52
 
53
53
  button[value=profile], button[value=email] { text-align: left; }
54
54
  button[value=delete], button[value=password] { text-align: right; }
55
55
 
56
- }
56
+ }*/
57
57
 
58
58
  section[on] { display: grid; }
59
59
  section { display: none; }
@@ -15,6 +15,7 @@ declare const DeleteUser_base: (new (...args: any[]) => {
15
15
  }) & typeof LitElement;
16
16
  export declare class DeleteUser extends DeleteUser_base {
17
17
  private login;
18
+ private email;
18
19
  constructor();
19
20
  protected firstUpdated(): void;
20
21
  stateChanged(state: AppState): void;
@@ -1 +1 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/custom-elements/settings/input/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5D,OAAc,EAAE,QAAQ,EAAE,MAAS,gBAAgB,CAAC;;;;;;;;;;;;;;AAIpD,qBAAa,UAAW,SAAQ,eAA0B;IAE/C,OAAO,CAAC,KAAK,CAAmB;;IAIzC,SAAS,CAAC,YAAY;IAQtB,YAAY,CAAC,KAAK,EAAE,QAAQ;IAI5B,MAAM,KAAK,MAAM,IAAI,cAAc,CAS3B;IAER,MAAM;IAaN,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,cAAc,CAQpB;CAEH;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/custom-elements/settings/input/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5D,OAAc,EAAE,QAAQ,EAAE,MAAS,gBAAgB,CAAC;;;;;;;;;;;;;;AAIpD,qBAAa,UAAW,SAAQ,eAA0B;IAE/C,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,KAAK,CAAc;;IAIpC,SAAS,CAAC,YAAY;IAQtB,YAAY,CAAC,KAAK,EAAE,QAAQ;IAK5B,MAAM,KAAK,MAAM,IAAI,cAAc,CAa3B;IAER,MAAM;IAaN,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,cAAc,CAQpB;CAEH;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -14,6 +14,7 @@ export class DeleteUser extends connect(store)(LitElement) {
14
14
  constructor() {
15
15
  super();
16
16
  this.login = false;
17
+ this.email = '';
17
18
  this.officialDelete = async () => {
18
19
  if (auth.currentUser) {
19
20
  return auth.currentUser.delete().then(() => { }).catch(() => { });
@@ -30,6 +31,7 @@ export class DeleteUser extends connect(store)(LitElement) {
30
31
  }
31
32
  stateChanged(state) {
32
33
  this.login = state.frontend.login;
34
+ this.email = state.backend.email;
33
35
  }
34
36
  static get styles() {
35
37
  return [
@@ -41,13 +43,17 @@ export class DeleteUser extends connect(store)(LitElement) {
41
43
  grid-template-rows: auto auto;
42
44
  }
43
45
 
46
+ p {
47
+ padding: 0 16px;
48
+ }
49
+
44
50
  `
45
51
  ];
46
52
  }
47
53
  render() {
48
54
  return html `
49
55
 
50
- <p>Permanently delete the user account and data related to:</p>
56
+ <p>Permanently delete the user account and data related to: ${this.email}</p>
51
57
 
52
58
  <button
53
59
  class="action-button deleteUser"
@@ -75,4 +81,7 @@ export class DeleteUser extends connect(store)(LitElement) {
75
81
  __decorate([
76
82
  state()
77
83
  ], DeleteUser.prototype, "login", void 0);
84
+ __decorate([
85
+ state()
86
+ ], DeleteUser.prototype, "email", void 0);
78
87
  customElements.define('delete-user', DeleteUser);
@@ -35,7 +35,7 @@ export class InputName extends connect(store)(LitElement) {
35
35
  }
36
36
  stateChanged(state) {
37
37
  this.login = state.frontend.login;
38
- this.value = state.frontend.name;
38
+ this.value = state.backend.name;
39
39
  }
40
40
  static get styles() {
41
41
  return [
@@ -17,6 +17,10 @@ export declare class ContactPhoto extends ContactPhoto_base {
17
17
  photo: string | void | any;
18
18
  private user;
19
19
  private login;
20
+ private progress;
21
+ private downloadURL;
22
+ private error;
23
+ private status;
20
24
  constructor();
21
25
  stateChanged(state: AppState): void;
22
26
  static get styles(): CSSResultArray;
@@ -1 +1 @@
1
- {"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../../../src/custom-elements/settings/input/uploader.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,UAAU,EAAE,cAAc,EAAE,MAAQ,KAAK,CAAC;AAE9D,OAAO,EAAS,QAAQ,EAAE,MAAe,gBAAgB,CAAC;;;;;;;;;;;;;;AAQ1D,qBAAa,YAAa,SAAQ,iBAA0B;IAGvC,KAAK,EAAG,MAAM,GAAG,IAAI,GAAG,GAAG,CAAM;IAE3C,OAAO,CAAC,IAAI,CAAsB;IAClC,OAAO,CAAC,KAAK,CAAmB;;IAMzC,YAAY,CAAC,KAAK,EAAE,QAAQ;IAU5B,MAAM,KAAK,MAAM,IAAG,cAAc,CAwBjC;IAED,SAAS,CAAC,MAAM;IAsEhB,OAAO,CAAC,oBAAoB;YAed,SAAS;IAmHvB,OAAO,CAAC,aAAa,CAYpB;CAEF;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC3B,eAAe,EAAE,YAAY,CAAC;KACjC;CACF"}
1
+ {"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../../../src/custom-elements/settings/input/uploader.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,UAAU,EAAE,cAAc,EAAE,MAAQ,KAAK,CAAC;AAE9D,OAAO,EAAS,QAAQ,EAAE,MAAe,gBAAgB,CAAC;;;;;;;;;;;;;;AAQ1D,qBAAa,YAAa,SAAQ,iBAA0B;IAGvC,KAAK,EAAG,MAAM,GAAG,IAAI,GAAG,GAAG,CAAM;IAE3C,OAAO,CAAC,IAAI,CAAsB;IAClC,OAAO,CAAC,KAAK,CAAmB;IAIhC,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,MAAM,CAAc;;IAWrC,YAAY,CAAC,KAAK,EAAE,QAAQ;IAU5B,MAAM,KAAK,MAAM,IAAG,cAAc,CAwBjC;IAED,SAAS,CAAC,MAAM;IA2EhB,OAAO,CAAC,oBAAoB;YAed,SAAS;IAsIvB,OAAO,CAAC,aAAa,CAYpB;CAEF;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC3B,eAAe,EAAE,YAAY,CAAC;KACjC;CACF"}
@@ -19,12 +19,20 @@ export class ContactPhoto extends connect(store)(LitElement) {
19
19
  this.photo = '';
20
20
  this.user = '';
21
21
  this.login = false;
22
+ this.progress = 0;
23
+ this.downloadURL = '';
24
+ this.error = '';
25
+ this.status = '';
22
26
  this.dispatchPhoto = async (url) => {
23
27
  if (auth.currentUser) {
24
28
  await updateProfile(auth.currentUser, { photoURL: url }).catch((error) => { console.log(error); });
25
29
  store.dispatch(accImage(url));
26
30
  }
27
31
  };
32
+ this.progress = 0;
33
+ this.downloadURL = '';
34
+ this.error = '';
35
+ this.status = '';
28
36
  }
29
37
  stateChanged(state) {
30
38
  this.login = state.frontend.login;
@@ -76,6 +84,8 @@ export class ContactPhoto extends connect(store)(LitElement) {
76
84
  margin: auto;
77
85
  "></label>
78
86
 
87
+
88
+
79
89
  <!-- Input - Upload Image -->
80
90
  <input
81
91
  id ="photoURL"
@@ -96,6 +106,7 @@ export class ContactPhoto extends connect(store)(LitElement) {
96
106
  style="
97
107
  border: 2px dashed;
98
108
  border-radius: 6px;
109
+ overflow: hidden;
99
110
  padding: 0 16px 16px 16px;
100
111
  "
101
112
  for ="photoURL">Photo:
@@ -117,6 +128,8 @@ export class ContactPhoto extends connect(store)(LitElement) {
117
128
  </canvas>
118
129
 
119
130
  </label>
131
+
132
+ <p style="text-align:center;">${this.status}</p>
120
133
  `;
121
134
  }
122
135
  appendToFileLocation(filePath, appendString) {
@@ -130,6 +143,8 @@ export class ContactPhoto extends connect(store)(LitElement) {
130
143
  async saveImage() {
131
144
  const uploader = this.shadowRoot.querySelector('.uploader');
132
145
  if (auth.currentUser) {
146
+ this.error = '';
147
+ this.status = 'Uploading...';
133
148
  const file = this.shadowRoot.querySelector('#photoURL');
134
149
  if (!file) {
135
150
  console.error('No file selected');
@@ -147,6 +162,16 @@ export class ContactPhoto extends connect(store)(LitElement) {
147
162
  };
148
163
  const uploadTask = uploadBytesResumable(location, file.files[0], newMetadata);
149
164
  uploadTask.on('state_changed', (snapshot) => {
165
+ this.progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
166
+ this.status = `Upload is ${Math.round(this.progress)}% done`;
167
+ switch (snapshot.state) {
168
+ case 'paused':
169
+ this.status = 'Upload is paused';
170
+ break;
171
+ case 'running':
172
+ this.status = `Upload is running (${Math.round(this.progress)}%)`;
173
+ break;
174
+ }
150
175
  let progress = 0;
151
176
  if (snapshot.totalBytes > 0) {
152
177
  progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
@@ -160,11 +185,13 @@ export class ContactPhoto extends connect(store)(LitElement) {
160
185
  uploader.textContent = '0%';
161
186
  }
162
187
  }, (error) => {
188
+ this.error = `Upload failed: ${error.message}`;
189
+ this.status = '';
163
190
  console.error('Upload failed:', error);
164
191
  uploader.value = 0;
165
192
  uploader.textContent = 'Error';
166
193
  }, async () => {
167
- getDownloadURL(uploadTask.snapshot.ref)
194
+ await getDownloadURL(uploadTask.snapshot.ref)
168
195
  .then((url) => {
169
196
  updateMetadata(location, newMetadata)
170
197
  .then(() => { }).catch((error) => { console.log("error: ", error); });
@@ -173,6 +200,7 @@ export class ContactPhoto extends connect(store)(LitElement) {
173
200
  uploader.value = 100;
174
201
  uploader.textContent = 'Complete';
175
202
  });
203
+ this.status = 'User profile updated successfully!';
176
204
  this.dispatchPhoto(url);
177
205
  }).catch(() => { });
178
206
  });
@@ -188,4 +216,16 @@ __decorate([
188
216
  __decorate([
189
217
  state()
190
218
  ], ContactPhoto.prototype, "login", void 0);
219
+ __decorate([
220
+ state()
221
+ ], ContactPhoto.prototype, "progress", void 0);
222
+ __decorate([
223
+ state()
224
+ ], ContactPhoto.prototype, "downloadURL", void 0);
225
+ __decorate([
226
+ state()
227
+ ], ContactPhoto.prototype, "error", void 0);
228
+ __decorate([
229
+ state()
230
+ ], ContactPhoto.prototype, "status", void 0);
191
231
  customElements.define('contact-photo', ContactPhoto);
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/custom-elements/settings/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAe,KAAK,CAAC;AAGrD,OAAO,EAAS,QAAQ,EAAE,MAAqB,aAAa,CAAC;AAG7D,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,eAAe,CAAC;AACvB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;AAGxB,qBACa,YAAa,SAAQ,iBAA0B;IAEjD,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,IAAI,CAAM;;IAI3B,SAAS,CAAC,YAAY;IA8BtB,YAAY,CAAC,KAAK,EAAE,QAAQ;IAK5B,MAAM,KAAK,MAAM,8BAmCX;IAEN,SAAS,CAAC,MAAM;CA6FjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC3B,eAAe,EAAE,YAAY,CAAC;KACjC;CACF"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/custom-elements/settings/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAe,KAAK,CAAC;AAGrD,OAAO,EAAS,QAAQ,EAAE,MAAqB,aAAa,CAAC;AAG7D,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,eAAe,CAAC;AACvB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;AAGxB,qBACa,YAAa,SAAQ,iBAA0B;IAEjD,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,IAAI,CAAM;;IAI3B,SAAS,CAAC,YAAY;IA8BtB,YAAY,CAAC,KAAK,EAAE,QAAQ;IAK5B,MAAM,KAAK,MAAM,8BAkCX;IAEN,SAAS,CAAC,MAAM;CA6FjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC3B,eAAe,EAAE,YAAY,CAAC;KACjC;CACF"}
@@ -52,7 +52,6 @@ let UserSettings = class UserSettings extends connect(store)(LitElement) {
52
52
 
53
53
  /* Button Padding for Border Outline */
54
54
  :host {
55
- margin: 0 3px 0 3px;
56
55
  display: grid;
57
56
  background-color: var(--pwa_settings_background);
58
57
  }