@things-factory/auth-ui 5.0.14 → 6.0.0-alpha.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.
Files changed (217) hide show
  1. package/client/{auth-style-sign.js → auth-style-sign.ts} +0 -0
  2. package/client/{bootstrap.js → bootstrap.ts} +2 -2
  3. package/client/components/{abstract-auth-page.js → abstract-auth-page.ts} +84 -66
  4. package/client/components/{abstract-password-reset.js → abstract-password-reset.ts} +29 -52
  5. package/client/components/{abstract-sign.js → abstract-sign.ts} +2 -2
  6. package/client/components/change-password.ts +99 -0
  7. package/client/components/{contact-us.js → contact-us.ts} +20 -14
  8. package/client/components/{create-domain-popup.js → create-domain-popup.ts} +48 -52
  9. package/client/components/{create-role.js → create-role.ts} +52 -62
  10. package/client/components/{create-user.js → create-user.ts} +51 -62
  11. package/client/components/delete-user-popup.ts +114 -0
  12. package/client/components/domain-switch.ts +118 -0
  13. package/client/components/{invite-customer.js → invite-customer.ts} +29 -35
  14. package/client/components/{invite-user.js → invite-user.ts} +24 -31
  15. package/client/components/{my-login-history.js → my-login-history.ts} +18 -24
  16. package/client/components/{ownership-transfer-popup.js → ownership-transfer-popup.ts} +39 -46
  17. package/client/components/partner-info-card.ts +89 -0
  18. package/client/components/{partner-role-editor.js → partner-role-editor.ts} +34 -39
  19. package/client/components/{profile-component.js → profile-component.ts} +97 -102
  20. package/client/components/{role-edit-form.js → role-edit-form.ts} +37 -49
  21. package/client/components/{role-privilege-editor.js → role-privilege-editor.ts} +67 -72
  22. package/client/components/role-selector.ts +102 -0
  23. package/client/components/{user-role-editor.js → user-role-editor.ts} +85 -84
  24. package/client/entries/auth/{activate.js → activate.ts} +124 -99
  25. package/client/entries/auth/{checkin.js → checkin.ts} +77 -79
  26. package/client/entries/auth/{forgot-password.js → forgot-password.ts} +8 -7
  27. package/client/entries/auth/{reset-password.js → reset-password.ts} +7 -2
  28. package/client/entries/auth/result.ts +189 -0
  29. package/client/entries/auth/{signin.js → signin.ts} +3 -2
  30. package/client/entries/auth/{signup.js → signup.ts} +12 -6
  31. package/client/entries/auth/{unlock-user.js → unlock-user.ts} +7 -2
  32. package/client/entries/oauth2/{oauth2-decision-error-page.js → oauth2-decision-error-page.ts} +9 -23
  33. package/client/entries/oauth2/{oauth2-decision-page.js → oauth2-decision-page.ts} +65 -86
  34. package/client/entries/public/home.ts +222 -0
  35. package/client/{index.js → index.ts} +4 -4
  36. package/client/pages/app-binding/{app-binding.js → app-binding.ts} +135 -138
  37. package/client/pages/app-binding/app-bindings.ts +152 -0
  38. package/client/pages/appliance/{appliance.js → appliance.ts} +125 -128
  39. package/client/pages/appliance/home.ts +155 -0
  40. package/client/pages/appliance/{register.js → register.ts} +13 -20
  41. package/client/pages/application/{application.js → application.ts} +127 -132
  42. package/client/pages/application/applications.ts +168 -0
  43. package/client/pages/application/register.ts +211 -0
  44. package/client/pages/domain/{domain-management.js → domain-management.ts} +23 -35
  45. package/client/pages/partner/{partner-management.js → partner-management.ts} +25 -30
  46. package/client/pages/{profile.js → profile.ts} +13 -15
  47. package/client/pages/role/role-management.ts +134 -0
  48. package/client/pages/user/{user-management.js → user-management.ts} +34 -39
  49. package/client/{route.js → route.ts} +0 -0
  50. package/client/utils/{password-rule.js → password-rule.ts} +2 -1
  51. package/dist-client/auth-style-sign.d.ts +1 -0
  52. package/dist-client/auth-style-sign.js +180 -0
  53. package/dist-client/auth-style-sign.js.map +1 -0
  54. package/dist-client/bootstrap.d.ts +3 -0
  55. package/dist-client/bootstrap.js +40 -0
  56. package/dist-client/bootstrap.js.map +1 -0
  57. package/dist-client/components/abstract-auth-page.d.ts +41 -0
  58. package/dist-client/components/abstract-auth-page.js +234 -0
  59. package/dist-client/components/abstract-auth-page.js.map +1 -0
  60. package/dist-client/components/abstract-password-reset.d.ts +20 -0
  61. package/dist-client/components/abstract-password-reset.js +159 -0
  62. package/dist-client/components/abstract-password-reset.js.map +1 -0
  63. package/dist-client/components/abstract-sign.d.ts +5 -0
  64. package/dist-client/components/abstract-sign.js +21 -0
  65. package/dist-client/components/abstract-sign.js.map +1 -0
  66. package/dist-client/components/change-password.d.ts +10 -0
  67. package/dist-client/components/change-password.js +100 -0
  68. package/dist-client/components/change-password.js.map +1 -0
  69. package/dist-client/components/contact-us.d.ts +20 -0
  70. package/dist-client/components/contact-us.js +125 -0
  71. package/dist-client/components/contact-us.js.map +1 -0
  72. package/dist-client/components/create-domain-popup.d.ts +1 -0
  73. package/dist-client/components/create-domain-popup.js +121 -0
  74. package/dist-client/components/create-domain-popup.js.map +1 -0
  75. package/dist-client/components/create-role.d.ts +1 -0
  76. package/dist-client/components/create-role.js +140 -0
  77. package/dist-client/components/create-role.js.map +1 -0
  78. package/dist-client/components/create-user.d.ts +1 -0
  79. package/dist-client/components/create-user.js +119 -0
  80. package/dist-client/components/create-user.js.map +1 -0
  81. package/dist-client/components/delete-user-popup.d.ts +8 -0
  82. package/dist-client/components/delete-user-popup.js +111 -0
  83. package/dist-client/components/delete-user-popup.js.map +1 -0
  84. package/dist-client/components/domain-switch.d.ts +16 -0
  85. package/dist-client/components/domain-switch.js +125 -0
  86. package/dist-client/components/domain-switch.js.map +1 -0
  87. package/dist-client/components/invite-customer.d.ts +1 -0
  88. package/dist-client/components/invite-customer.js +105 -0
  89. package/dist-client/components/invite-customer.js.map +1 -0
  90. package/dist-client/components/invite-user.d.ts +1 -0
  91. package/dist-client/components/invite-user.js +92 -0
  92. package/dist-client/components/invite-user.js.map +1 -0
  93. package/dist-client/components/my-login-history.d.ts +1 -0
  94. package/dist-client/components/my-login-history.js +109 -0
  95. package/dist-client/components/my-login-history.js.map +1 -0
  96. package/dist-client/components/ownership-transfer-popup.d.ts +1 -0
  97. package/dist-client/components/ownership-transfer-popup.js +106 -0
  98. package/dist-client/components/ownership-transfer-popup.js.map +1 -0
  99. package/dist-client/components/partner-info-card.d.ts +6 -0
  100. package/dist-client/components/partner-info-card.js +92 -0
  101. package/dist-client/components/partner-info-card.js.map +1 -0
  102. package/dist-client/components/partner-role-editor.d.ts +2 -0
  103. package/dist-client/components/partner-role-editor.js +167 -0
  104. package/dist-client/components/partner-role-editor.js.map +1 -0
  105. package/dist-client/components/profile-component.d.ts +21 -0
  106. package/dist-client/components/profile-component.js +224 -0
  107. package/dist-client/components/profile-component.js.map +1 -0
  108. package/dist-client/components/role-edit-form.d.ts +1 -0
  109. package/dist-client/components/role-edit-form.js +93 -0
  110. package/dist-client/components/role-edit-form.js.map +1 -0
  111. package/dist-client/components/role-privilege-editor.d.ts +1 -0
  112. package/dist-client/components/role-privilege-editor.js +243 -0
  113. package/dist-client/components/role-privilege-editor.js.map +1 -0
  114. package/dist-client/components/role-selector.d.ts +14 -0
  115. package/dist-client/components/role-selector.js +116 -0
  116. package/dist-client/components/role-selector.js.map +1 -0
  117. package/dist-client/components/user-role-editor.d.ts +2 -0
  118. package/dist-client/components/user-role-editor.js +472 -0
  119. package/dist-client/components/user-role-editor.js.map +1 -0
  120. package/dist-client/entries/auth/activate.d.ts +28 -0
  121. package/dist-client/entries/auth/activate.js +263 -0
  122. package/dist-client/entries/auth/activate.js.map +1 -0
  123. package/dist-client/entries/auth/checkin.d.ts +23 -0
  124. package/dist-client/entries/auth/checkin.js +185 -0
  125. package/dist-client/entries/auth/checkin.js.map +1 -0
  126. package/dist-client/entries/auth/forgot-password.d.ts +16 -0
  127. package/dist-client/entries/auth/forgot-password.js +95 -0
  128. package/dist-client/entries/auth/forgot-password.js.map +1 -0
  129. package/dist-client/entries/auth/reset-password.d.ts +7 -0
  130. package/dist-client/entries/auth/reset-password.js +22 -0
  131. package/dist-client/entries/auth/reset-password.js.map +1 -0
  132. package/dist-client/entries/auth/result.d.ts +20 -0
  133. package/dist-client/entries/auth/result.js +191 -0
  134. package/dist-client/entries/auth/result.js.map +1 -0
  135. package/dist-client/entries/auth/signin.d.ts +5 -0
  136. package/dist-client/entries/auth/signin.js +16 -0
  137. package/dist-client/entries/auth/signin.js.map +1 -0
  138. package/dist-client/entries/auth/signup.d.ts +11 -0
  139. package/dist-client/entries/auth/signup.js +81 -0
  140. package/dist-client/entries/auth/signup.js.map +1 -0
  141. package/dist-client/entries/auth/unlock-user.d.ts +7 -0
  142. package/dist-client/entries/auth/unlock-user.js +22 -0
  143. package/dist-client/entries/auth/unlock-user.js.map +1 -0
  144. package/dist-client/entries/oauth2/oauth2-decision-error-page.d.ts +1 -0
  145. package/dist-client/entries/oauth2/oauth2-decision-error-page.js +78 -0
  146. package/dist-client/entries/oauth2/oauth2-decision-error-page.js.map +1 -0
  147. package/dist-client/entries/oauth2/oauth2-decision-page.d.ts +2 -0
  148. package/dist-client/entries/oauth2/oauth2-decision-page.js +223 -0
  149. package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -0
  150. package/dist-client/entries/public/home.d.ts +20 -0
  151. package/dist-client/entries/public/home.js +225 -0
  152. package/dist-client/entries/public/home.js.map +1 -0
  153. package/dist-client/index.d.ts +6 -0
  154. package/dist-client/index.js +65 -0
  155. package/dist-client/index.js.map +1 -0
  156. package/dist-client/pages/app-binding/app-binding.d.ts +1 -0
  157. package/dist-client/pages/app-binding/app-binding.js +396 -0
  158. package/dist-client/pages/app-binding/app-binding.js.map +1 -0
  159. package/dist-client/pages/app-binding/app-bindings.d.ts +1 -0
  160. package/dist-client/pages/app-binding/app-bindings.js +152 -0
  161. package/dist-client/pages/app-binding/app-bindings.js.map +1 -0
  162. package/dist-client/pages/appliance/appliance.d.ts +1 -0
  163. package/dist-client/pages/appliance/appliance.js +377 -0
  164. package/dist-client/pages/appliance/appliance.js.map +1 -0
  165. package/dist-client/pages/appliance/home.d.ts +1 -0
  166. package/dist-client/pages/appliance/home.js +155 -0
  167. package/dist-client/pages/appliance/home.js.map +1 -0
  168. package/dist-client/pages/appliance/register.d.ts +1 -0
  169. package/dist-client/pages/appliance/register.js +182 -0
  170. package/dist-client/pages/appliance/register.js.map +1 -0
  171. package/dist-client/pages/application/application.d.ts +1 -0
  172. package/dist-client/pages/application/application.js +372 -0
  173. package/dist-client/pages/application/application.js.map +1 -0
  174. package/dist-client/pages/application/applications.d.ts +1 -0
  175. package/dist-client/pages/application/applications.js +168 -0
  176. package/dist-client/pages/application/applications.js.map +1 -0
  177. package/dist-client/pages/application/register.d.ts +1 -0
  178. package/dist-client/pages/application/register.js +212 -0
  179. package/dist-client/pages/application/register.js.map +1 -0
  180. package/dist-client/pages/domain/domain-management.d.ts +50 -0
  181. package/dist-client/pages/domain/domain-management.js +264 -0
  182. package/dist-client/pages/domain/domain-management.js.map +1 -0
  183. package/dist-client/pages/partner/partner-management.d.ts +4 -0
  184. package/dist-client/pages/partner/partner-management.js +119 -0
  185. package/dist-client/pages/partner/partner-management.js.map +1 -0
  186. package/dist-client/pages/profile.d.ts +11 -0
  187. package/dist-client/pages/profile.js +32 -0
  188. package/dist-client/pages/profile.js.map +1 -0
  189. package/dist-client/pages/role/role-management.d.ts +4 -0
  190. package/dist-client/pages/role/role-management.js +146 -0
  191. package/dist-client/pages/role/role-management.js.map +1 -0
  192. package/dist-client/pages/user/user-management.d.ts +5 -0
  193. package/dist-client/pages/user/user-management.js +231 -0
  194. package/dist-client/pages/user/user-management.js.map +1 -0
  195. package/dist-client/route.d.ts +1 -0
  196. package/dist-client/route.js +47 -0
  197. package/dist-client/route.js.map +1 -0
  198. package/dist-client/tsconfig.tsbuildinfo +1 -0
  199. package/dist-client/utils/password-rule.d.ts +12 -0
  200. package/dist-client/utils/password-rule.js +21 -0
  201. package/dist-client/utils/password-rule.js.map +1 -0
  202. package/dist-server/tsconfig.tsbuildinfo +1 -1
  203. package/package.json +14 -12
  204. package/things-factory.config.js +15 -54
  205. package/translations/ko.json +14 -19
  206. package/client/components/change-password.js +0 -111
  207. package/client/components/delete-user-popup.js +0 -116
  208. package/client/components/domain-switch.js +0 -123
  209. package/client/components/partner-info-card.js +0 -95
  210. package/client/components/role-selector.js +0 -116
  211. package/client/entries/auth/result.js +0 -193
  212. package/client/entries/public/home.js +0 -237
  213. package/client/pages/app-binding/app-bindings.js +0 -233
  214. package/client/pages/appliance/home.js +0 -159
  215. package/client/pages/application/applications.js +0 -248
  216. package/client/pages/application/register.js +0 -292
  217. package/client/pages/role/role-management.js +0 -210
@@ -4,9 +4,9 @@ import '@operato/i18n'
4
4
  import { html } from 'lit-html'
5
5
 
6
6
  import { TOOL_POSITION } from '@operato/layout'
7
- import { auth } from '@things-factory/auth-base'
7
+ import { auth } from '@things-factory/auth-base/dist-client'
8
8
  import { ADD_MORENDA } from '@things-factory/more-base'
9
- import { navigate, store } from '@things-factory/shell'
9
+ import { navigate, store } from '@things-factory/shell/client'
10
10
 
11
11
  export default function bootstrap() {
12
12
  /* add user profile morenda */
@@ -7,69 +7,72 @@ import '@operato/i18n/ox-i18n-selector.js'
7
7
  import '@operato/layout/ox-snack-bar.js'
8
8
 
9
9
  import { css, html, LitElement } from 'lit'
10
+ import { property, query } from 'lit/decorators.js'
10
11
 
11
12
  import { i18next, localize } from '@operato/i18n'
12
13
  import { ScrollbarStyles } from '@operato/styles'
13
14
  import { isSafari } from '@operato/utils'
14
15
 
15
- import { AUTH_STYLE_SIGN } from '../auth-style-sign'
16
+ import { AUTH_STYLE_SIGN } from '../auth-style-sign.js'
16
17
 
17
- export class AbstractAuthPage extends localize(i18next)(LitElement) {
18
- static get styles() {
19
- return [
20
- ScrollbarStyles,
21
- css`
22
- :host {
23
- position: relative;
24
- overflow: hidden;
18
+ export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
19
+ static styles = [
20
+ ScrollbarStyles,
21
+ css`
22
+ :host {
23
+ position: relative;
24
+ overflow: hidden;
25
25
 
26
- display: flex;
27
- flex-direction: row;
26
+ display: flex;
27
+ flex-direction: row;
28
28
 
29
- width: 100vw;
30
- height: 100vh;
31
- }
32
- .content {
33
- flex: 1;
34
- overflow: auto;
35
- }
29
+ width: 100vw;
30
+ height: 100vh;
31
+ }
32
+ .content {
33
+ flex: 1;
34
+ overflow: auto;
35
+ }
36
36
 
37
- [home] {
38
- position: absolute;
39
- top: 10px;
40
- left: 10px;
41
- font-size: 2em;
42
- color: white;
43
- }
37
+ [home] {
38
+ position: absolute;
39
+ top: 10px;
40
+ left: 10px;
41
+ font-size: 2em;
42
+ color: white;
43
+ }
44
44
 
45
- [hidden] {
46
- display: none;
47
- }
45
+ [hidden] {
46
+ display: none;
47
+ }
48
+
49
+ #snackbar {
50
+ width: 100%;
51
+ z-index: 10;
52
+ }
48
53
 
49
- #snackbar {
54
+ @media print {
55
+ :host {
50
56
  width: 100%;
51
- z-index: 10;
57
+ height: 100%;
58
+ min-height: 100vh;
52
59
  }
60
+ }
61
+ `,
62
+ AUTH_STYLE_SIGN
63
+ ]
53
64
 
54
- @media print {
55
- :host {
56
- width: 100%;
57
- height: 100%;
58
- min-height: 100vh;
59
- }
60
- }
61
- `,
62
- AUTH_STYLE_SIGN
63
- ]
64
- }
65
+ @property({ type: Object }) data: any
66
+ @property({ type: String }) message?: string
67
+ @property({ type: Object }) detail: any
68
+ @property({ type: String }) redirectTo?: string
65
69
 
66
- static get properties() {
67
- return {
68
- data: Object,
69
- message: String,
70
- detail: Object,
71
- redirectTo: String
72
- }
70
+ @query('#form') formEl!: HTMLFormElement
71
+
72
+ private _applicationMeta?: {
73
+ icon: string
74
+ title: string
75
+ description: string
73
76
  }
74
77
 
75
78
  render() {
@@ -130,7 +133,7 @@ export class AbstractAuthPage extends localize(i18next)(LitElement) {
130
133
 
131
134
  firstUpdated() {
132
135
  setTimeout(() => {
133
- this.renderRoot.querySelector('mwc-textfield').focus()
136
+ ;(this.renderRoot.querySelector('mwc-textfield') as any).focus()
134
137
  }, 100)
135
138
 
136
139
  this.formEl.reset = () => {
@@ -145,13 +148,10 @@ export class AbstractAuthPage extends localize(i18next)(LitElement) {
145
148
  }
146
149
  }
147
150
 
148
- get pageName() {}
151
+ abstract get pageName(): string
152
+ abstract get actionUrl(): string
149
153
 
150
- get formEl() {
151
- return this.renderRoot.querySelector('#form')
152
- }
153
-
154
- get formElements() {
154
+ get formElements(): HTMLInputElement[] {
155
155
  return Array.from(this.formEl.querySelectorAll('[name]'))
156
156
  }
157
157
 
@@ -168,10 +168,18 @@ export class AbstractAuthPage extends localize(i18next)(LitElement) {
168
168
  label=${i18next.t('field.email')}
169
169
  required
170
170
  .value=${email}
171
+ .validationMessage=${i18next.t('text.invalid-email')}
172
+ autocomplete="username email"
171
173
  ></mwc-textfield>
172
174
  </div>
173
175
  <div class="field">
174
- <mwc-textfield name="password" type="password" label=${i18next.t('field.password')} required></mwc-textfield>
176
+ <mwc-textfield
177
+ name="password"
178
+ type="password"
179
+ label=${i18next.t('field.password')}
180
+ autocomplete="password"
181
+ required
182
+ ></mwc-textfield>
175
183
  </div>
176
184
 
177
185
  <mwc-button class="ui" type="submit" raised @click=${e => this._onSubmit(e)}>
@@ -201,10 +209,15 @@ export class AbstractAuthPage extends localize(i18next)(LitElement) {
201
209
  return this.formElements.every(el => el.checkValidity())
202
210
  }
203
211
 
204
- async submit() {}
212
+ abstract submit()
213
+
214
+ showSnackbar({ level, message, timer = 3000 }: { level?: string; message?: string; timer?: number } = {}) {
215
+ const snackbar = this.renderRoot.querySelector('#snackbar') as HTMLElement & {
216
+ level: string
217
+ message: string
218
+ active: boolean
219
+ }
205
220
 
206
- showSnackbar({ level, message, timer = 3000 } = {}) {
207
- const snackbar = this.renderRoot.querySelector('#snackbar')
208
221
  if (level) snackbar.level = level
209
222
  if (message) snackbar.message = message
210
223
  snackbar.active = true
@@ -216,20 +229,25 @@ export class AbstractAuthPage extends localize(i18next)(LitElement) {
216
229
  }
217
230
 
218
231
  hideSnackbar() {
219
- const snackbar = this.renderRoot.querySelector('#snackbar')
232
+ const snackbar = this.renderRoot.querySelector('#snackbar') as HTMLElement & {
233
+ level: string
234
+ message: string
235
+ active: boolean
236
+ }
237
+
220
238
  snackbar.active = false
221
239
  }
222
240
 
223
241
  get applicationMeta() {
224
242
  if (!this._applicationMeta) {
225
- var iconLink = document.querySelector('link[rel="application-icon"]')
226
- var titleMeta = document.querySelector('meta[name="application-name"]')
227
- var descriptionMeta = document.querySelector('meta[name="application-description"]')
243
+ var iconLink: HTMLLinkElement | null = document.querySelector('link[rel="application-icon"]')
244
+ var titleMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-name"]')
245
+ var descriptionMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-description"]')
228
246
 
229
247
  this._applicationMeta = {
230
- icon: iconLink ? iconLink.href : logo,
231
- title: titleMeta ? titleMeta.content : 'Things Factory',
232
- description: descriptionMeta ? descriptionMeta.content : 'Reimagining Software'
248
+ icon: iconLink?.href || '',
249
+ title: titleMeta?.content || 'Things Factory',
250
+ description: descriptionMeta?.content || 'Reimagining Software'
233
251
  }
234
252
  }
235
253
 
@@ -6,6 +6,7 @@ import '@operato/i18n/ox-i18n-selector.js'
6
6
  import '@operato/layout/ox-snack-bar.js'
7
7
 
8
8
  import { css, html } from 'lit'
9
+ import { property, query } from 'lit/decorators.js'
9
10
 
10
11
  import { i18next } from '@operato/i18n'
11
12
  import { isSafari } from '@operato/utils'
@@ -14,47 +15,40 @@ import { AUTH_STYLE_SIGN } from '../auth-style-sign'
14
15
  import { generatePasswordPatternHelp, generatePasswordPatternRegExp } from '../utils/password-rule'
15
16
  import { AbstractAuthPage } from './abstract-auth-page'
16
17
 
17
- export class AbstractPasswordReset extends AbstractAuthPage {
18
- static get styles() {
19
- return [
20
- css`
21
- :host {
22
- position: relative;
23
- overflow: hidden;
18
+ export abstract class AbstractPasswordReset extends AbstractAuthPage {
19
+ static styles = [
20
+ css`
21
+ :host {
22
+ position: relative;
23
+ overflow: hidden;
24
24
 
25
- display: flex;
26
- flex-direction: row;
25
+ display: flex;
26
+ flex-direction: row;
27
27
 
28
- width: 100vw;
29
- height: 100vh;
30
- }
28
+ width: 100vw;
29
+ height: 100vh;
30
+ }
31
31
 
32
- @media print {
33
- :host {
34
- width: 100%;
35
- height: 100%;
36
- min-height: 100vh;
37
- }
32
+ @media print {
33
+ :host {
34
+ width: 100%;
35
+ height: 100%;
36
+ min-height: 100vh;
38
37
  }
39
- `,
40
- AUTH_STYLE_SIGN
41
- ]
42
- }
38
+ }
39
+ `,
40
+ AUTH_STYLE_SIGN
41
+ ]
43
42
 
44
- static get properties() {
45
- return {
46
- data: Object,
47
- token: String
48
- }
49
- }
43
+ @property({ type: Object }) data: any
44
+ @property({ type: String }) token?: string
50
45
 
51
- get actionUrl() {
52
- return ''
53
- }
46
+ @query('#confirm-password') confirmPass!: HTMLElement
54
47
 
55
- get submitButtonLabel() {
56
- return ''
57
- }
48
+ private passwordPattern: string = ''
49
+ private passwordHelp: string = ''
50
+
51
+ abstract get submitButtonLabel(): string
58
52
 
59
53
  render() {
60
54
  var { icon, title, description } = this.applicationMeta
@@ -88,8 +82,7 @@ export class AbstractPasswordReset extends AbstractAuthPage {
88
82
  helperPersistent
89
83
  @input=${e => {
90
84
  var val = e.target.value
91
- var confirmPass = this.renderRoot.querySelector('#confirm-password')
92
- confirmPass.setAttribute('pattern', val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '[$&]'))
85
+ this.confirmPass.setAttribute('pattern', val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '[$&]'))
93
86
  }}
94
87
  required
95
88
  ></mwc-textfield>
@@ -162,20 +155,4 @@ export class AbstractPasswordReset extends AbstractAuthPage {
162
155
  async submit() {
163
156
  this.formEl.submit()
164
157
  }
165
-
166
- get applicationMeta() {
167
- if (!this._applicationMeta) {
168
- var iconLink = document.querySelector('link[rel="application-icon"]')
169
- var titleMeta = document.querySelector('meta[name="application-name"]')
170
- var descriptionMeta = document.querySelector('meta[name="application-description"]')
171
-
172
- this._applicationMeta = {
173
- icon: iconLink ? iconLink.href : logo,
174
- title: titleMeta ? titleMeta.content : 'Things Factory',
175
- description: descriptionMeta ? descriptionMeta.content : 'Reimagining Software'
176
- }
177
- }
178
-
179
- return this._applicationMeta
180
- }
181
158
  }
@@ -1,6 +1,6 @@
1
- import { AbstractAuthPage } from './abstract-auth-page'
1
+ import { AbstractAuthPage } from './abstract-auth-page.js'
2
2
 
3
- export class AbstractSign extends AbstractAuthPage {
3
+ export abstract class AbstractSign extends AbstractAuthPage {
4
4
  async submit() {
5
5
  this.formEl.submit()
6
6
  }
@@ -0,0 +1,99 @@
1
+ import { css, html, LitElement } from 'lit'
2
+ import { customElement, query } from 'lit/decorators.js'
3
+
4
+ import { i18next, localize } from '@operato/i18n'
5
+ import { auth } from '@things-factory/auth-base/dist-client'
6
+
7
+ @customElement('change-password')
8
+ export class ChangePassword extends localize(i18next)(LitElement) {
9
+ static styles = [
10
+ css`
11
+ * {
12
+ box-sizing: border-box;
13
+ }
14
+ *:focus {
15
+ outline: none;
16
+ }
17
+ input {
18
+ border: var(--change-password-field-border);
19
+ border-radius: var(--change-password-field-border-radius);
20
+ margin: var(--change-password-field-margin);
21
+ padding: var(--change-password-field-padding);
22
+
23
+ font: var(--change-password-field-font);
24
+ width: var(--change-password-field-width);
25
+ }
26
+ input:focus {
27
+ border: 1px solid var(--focus-background-color);
28
+ }
29
+
30
+ ::placeholder {
31
+ font-size: 0.8rem;
32
+ text-transform: capitalize;
33
+ }
34
+
35
+ mwc-button {
36
+ margin: var(--margin-narrow) 0 var(--margin-default) 0;
37
+ }
38
+
39
+ button {
40
+ background-color: var(--secondary-color, #394e64);
41
+ margin: 2px 2px 10px 2px;
42
+ height: var(--button-height, 28px);
43
+ color: var(--button-color, #fff);
44
+ font: var(--button-font);
45
+ border-radius: var(--button-radius, 5px);
46
+ border: var(--button-border, 1px solid transparent);
47
+ line-height: 1.5;
48
+ }
49
+ button:hover,
50
+ button:active {
51
+ background-color: var(--button-active-background-color, #22a6a7);
52
+ border: var(--button-active-border);
53
+ }
54
+ `
55
+ ]
56
+
57
+ @query('form') form!: HTMLFormElement
58
+
59
+ render() {
60
+ return html`
61
+ <form>
62
+ <div class="field">
63
+ <input type="password" name="current_pass" placeholder=${i18next.t('text.current password')} required />
64
+ </div>
65
+ <div class="field">
66
+ <input type="password" name="new_pass" placeholder=${i18next.t('text.new password')} required />
67
+ </div>
68
+ <div class="field">
69
+ <input type="password" name="confirm_pass" placeholder=${i18next.t('text.confirm password')} required />
70
+ </div>
71
+
72
+ <mwc-button raised label="${i18next.t('text.change password')}" @click=${this.submit.bind(this)}></mwc-button>
73
+ </form>
74
+ `
75
+ }
76
+
77
+ async submit() {
78
+ const formData = new FormData(this.form)
79
+ let params = {}
80
+ for (const [key, value] of formData.entries()) {
81
+ if (!value) {
82
+ const placeholder = (this.form.querySelector(`[name=${key}]`) as HTMLInputElement)?.placeholder
83
+ return this.showToast(i18next.t('error.value is empty', { value: placeholder || key }))
84
+ }
85
+ params[key] = value
86
+ }
87
+
88
+ if (params['new_pass'] !== params['confirm_pass']) {
89
+ return this.showToast(i18next.t('error.new_password_and_confirm_password_do_not_match'))
90
+ }
91
+
92
+ auth.changePassword(params)
93
+ this.form.reset()
94
+ }
95
+
96
+ showToast(message) {
97
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message } }))
98
+ }
99
+ }
@@ -5,10 +5,12 @@ import '@material/mwc-dialog'
5
5
  import '@operato/i18n'
6
6
 
7
7
  import { css, html, LitElement } from 'lit'
8
+ import { customElement, query } from 'lit/decorators.js'
8
9
 
9
10
  import { i18next, localize } from '@operato/i18n'
10
- import { auth } from '@things-factory/auth-base'
11
+ import { auth } from '@things-factory/auth-base/dist-client'
11
12
 
13
+ @customElement('contact-us')
12
14
  export class ContactUs extends localize(i18next)(LitElement) {
13
15
  static get styles() {
14
16
  return [
@@ -16,9 +18,11 @@ export class ContactUs extends localize(i18next)(LitElement) {
16
18
  :host {
17
19
  --mdc-theme-primary: var(--primary-color);
18
20
  }
21
+
19
22
  * {
20
23
  box-sizing: border-box;
21
24
  }
25
+
22
26
  *:focus {
23
27
  outline: none;
24
28
  }
@@ -32,13 +36,15 @@ export class ContactUs extends localize(i18next)(LitElement) {
32
36
  ]
33
37
  }
34
38
 
35
- get dialog() {
36
- return this.renderRoot.querySelector('#dialog')
37
- }
39
+ @query('#dialog') dialog!: HTMLElement & { open: boolean }
40
+ @query('#subject-input') subjectInput!: HTMLInputElement
41
+ @query('#sender-input') senderInput!: HTMLInputElement
42
+ @query('#content-input') contentInput!: HTMLInputElement
38
43
 
39
44
  render() {
40
45
  return html`
41
- <mwc-button label=${i18next.t('button.need help')} @click=${e => (this.dialog.open = true)}></mwc-button>
46
+ <mwc-button raised label=${i18next.t('button.need help')} @click=${e => (this.dialog.open = true)}></mwc-button>
47
+
42
48
  <mwc-dialog id="dialog" heading=${i18next.t('title.need help')}>
43
49
  <form action="" method="POST">
44
50
  <input id="subject-input" name="subject" type="hidden" />
@@ -53,7 +59,7 @@ export class ContactUs extends localize(i18next)(LitElement) {
53
59
  required
54
60
  @input=${e => {
55
61
  const val = e.target.value
56
- this.renderRoot.querySelector('#subject-input').value = val
62
+ this.subjectInput.value = val
57
63
  }}
58
64
  ></mwc-textfield>
59
65
  <mwc-textfield
@@ -63,7 +69,7 @@ export class ContactUs extends localize(i18next)(LitElement) {
63
69
  required
64
70
  @input=${e => {
65
71
  const val = e.target.value
66
- this.renderRoot.querySelector('#sender-input').value = val
72
+ this.senderInput.value = val
67
73
  }}
68
74
  ></mwc-textfield>
69
75
  <mwc-textarea
@@ -73,7 +79,7 @@ export class ContactUs extends localize(i18next)(LitElement) {
73
79
  @keydown=${e => e.stopPropagation()}
74
80
  @input=${e => {
75
81
  const val = e.target.value
76
- this.renderRoot.querySelector('#content-input').value = val
82
+ this.contentInput.value = val
77
83
  }}
78
84
  ></mwc-textarea>
79
85
  </div>
@@ -82,19 +88,21 @@ export class ContactUs extends localize(i18next)(LitElement) {
82
88
  type="submit"
83
89
  label=${i18next.t('button.submit')}
84
90
  raised
85
- @click=${e => this._submit()}
91
+ @click=${e => this._submit(e)}
86
92
  ></mwc-button>
87
93
  <mwc-button slot="secondaryAction" dialogAction="cancel" label=${i18next.t('button.cancel')}></mwc-button>
88
94
  </mwc-dialog>
89
95
  `
90
96
  }
91
97
 
92
- _checkValidity() {}
98
+ _checkValidity(): boolean {
99
+ return false
100
+ }
93
101
 
94
- _submit(e) {
102
+ _submit(e: MouseEvent) {
95
103
  if (!this._checkValidity()) return
96
104
 
97
- const form = e.target
105
+ const form = e.target as HTMLFormElement
98
106
 
99
107
  const formData = new FormData(form)
100
108
  let json = {}
@@ -109,5 +117,3 @@ export class ContactUs extends localize(i18next)(LitElement) {
109
117
  form.reset()
110
118
  }
111
119
  }
112
-
113
- customElements.define('contact-us', ContactUs)
@@ -2,59 +2,56 @@ import '@material/mwc-button'
2
2
 
3
3
  import gql from 'graphql-tag'
4
4
  import { css, html, LitElement } from 'lit'
5
+ import { customElement } from 'lit/decorators.js'
5
6
 
7
+ import { client } from '@operato/graphql'
6
8
  import { i18next, localize } from '@operato/i18n'
7
- import { client, CustomAlert } from '@things-factory/shell'
9
+ import { CustomAlert } from '@things-factory/shell/client'
8
10
 
11
+ @customElement('create-domain-popup')
9
12
  class CreateDomainPopup extends localize(i18next)(LitElement) {
10
- static get properties() {
11
- return {}
12
- }
13
-
14
- static get styles() {
15
- return [
16
- css`
17
- :host {
18
- display: flex;
19
- flex-direction: column;
20
- background-color: var(--main-section-background-color);
21
- padding: var(--padding-wide);
22
- overflow: auto;
23
- }
24
- input.checkValidName {
25
- background-color: #fce6e6;
26
- }
27
- mwc-button {
28
- display: flex;
29
- justify-content: center;
30
- }
31
- label {
32
- display: flex;
33
- flex-direction: column;
34
-
35
- font: var(--label-font);
36
- color: var(--label-color);
37
- text-transform: var(--label-text-transform);
38
- }
39
- input {
40
- border: var(--border-dark-color);
41
- border-radius: var(--border-radius);
42
- margin: var(--input-margin);
43
- padding: var(--input-padding);
44
- background-color: var(--theme-white-color);
45
- font: var(--input-font);
46
-
47
- flex: 1;
48
- }
49
- [field] {
50
- grid-column: span 2;
51
- }
52
- [buttons] {
53
- margin-top: auto;
54
- }
55
- `
56
- ]
57
- }
13
+ static styles = [
14
+ css`
15
+ :host {
16
+ display: flex;
17
+ flex-direction: column;
18
+ background-color: var(--main-section-background-color);
19
+ padding: var(--padding-wide);
20
+ overflow: auto;
21
+ }
22
+ input.checkValidName {
23
+ background-color: #fce6e6;
24
+ }
25
+ mwc-button {
26
+ display: flex;
27
+ justify-content: center;
28
+ }
29
+ label {
30
+ display: flex;
31
+ flex-direction: column;
32
+
33
+ font: var(--label-font);
34
+ color: var(--label-color);
35
+ text-transform: var(--label-text-transform);
36
+ }
37
+ input {
38
+ border: var(--border-dark-color);
39
+ border-radius: var(--border-radius);
40
+ margin: var(--input-margin);
41
+ padding: var(--input-padding);
42
+ background-color: var(--theme-white-color);
43
+ font: var(--input-font);
44
+
45
+ flex: 1;
46
+ }
47
+ [field] {
48
+ grid-column: span 2;
49
+ }
50
+ [buttons] {
51
+ margin-top: auto;
52
+ }
53
+ `
54
+ ]
58
55
 
59
56
  render() {
60
57
  return html`
@@ -93,9 +90,10 @@ class CreateDomainPopup extends localize(i18next)(LitElement) {
93
90
  }
94
91
 
95
92
  async onCreateDomain() {
96
- const domainInput = {}
93
+ const domainInput: { [prop: string]: string } = {}
97
94
  this.inputData.forEach(data => (domainInput[data.name] = data.value))
98
95
  const regExp = /^[a-zA-z ]+$/
96
+
99
97
  if (!regExp.test(domainInput.name)) {
100
98
  return this.showToast(i18next.t('error: domain name should consist only of letters or dashes'))
101
99
  }
@@ -130,5 +128,3 @@ class CreateDomainPopup extends localize(i18next)(LitElement) {
130
128
  document.dispatchEvent(new CustomEvent('notify', { detail: { message } }))
131
129
  }
132
130
  }
133
-
134
- window.customElements.define('create-domain-popup', CreateDomainPopup)