@things-factory/auth-ui 8.0.37 → 9.0.0-9.0.0-beta.59.0

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 (142) hide show
  1. package/dist-client/components/abstract-auth-page.d.ts +1 -1
  2. package/dist-client/components/abstract-auth-page.js +2 -0
  3. package/dist-client/components/abstract-auth-page.js.map +1 -1
  4. package/dist-client/components/abstract-password-reset.d.ts +2 -2
  5. package/dist-client/components/abstract-password-reset.js +5 -5
  6. package/dist-client/components/abstract-password-reset.js.map +1 -1
  7. package/dist-client/components/change-password.js +1 -1
  8. package/dist-client/components/change-password.js.map +1 -1
  9. package/dist-client/components/invite-user.d.ts +1 -1
  10. package/dist-client/components/invite-user.js +1 -2
  11. package/dist-client/components/invite-user.js.map +1 -1
  12. package/dist-client/components/partner-role-editor.js +1 -1
  13. package/dist-client/components/partner-role-editor.js.map +1 -1
  14. package/dist-client/components/profile-component.d.ts +3 -3
  15. package/dist-client/components/profile-component.js +3 -3
  16. package/dist-client/components/profile-component.js.map +1 -1
  17. package/dist-client/components/role-privilege-editor.js +2 -1
  18. package/dist-client/components/role-privilege-editor.js.map +1 -1
  19. package/dist-client/components/user-role-editor.d.ts +2 -2
  20. package/dist-client/components/user-role-editor.js +2 -2
  21. package/dist-client/components/user-role-editor.js.map +1 -1
  22. package/dist-client/constants/index.d.ts +1 -1
  23. package/dist-client/constants/index.js +1 -1
  24. package/dist-client/constants/index.js.map +1 -1
  25. package/dist-client/entries/auth/activate.d.ts +1 -1
  26. package/dist-client/entries/auth/activate.js +1 -1
  27. package/dist-client/entries/auth/activate.js.map +1 -1
  28. package/dist-client/entries/auth/checkin.js +2 -2
  29. package/dist-client/entries/auth/checkin.js.map +1 -1
  30. package/dist-client/entries/auth/forgot-password.d.ts +2 -2
  31. package/dist-client/entries/auth/forgot-password.js +11 -3
  32. package/dist-client/entries/auth/forgot-password.js.map +1 -1
  33. package/dist-client/entries/auth/reset-password.d.ts +1 -1
  34. package/dist-client/entries/auth/reset-password.js +1 -1
  35. package/dist-client/entries/auth/reset-password.js.map +1 -1
  36. package/dist-client/entries/auth/result.d.ts +1 -1
  37. package/dist-client/entries/auth/result.js +1 -1
  38. package/dist-client/entries/auth/result.js.map +1 -1
  39. package/dist-client/entries/auth/signin.d.ts +1 -1
  40. package/dist-client/entries/auth/signin.js +1 -1
  41. package/dist-client/entries/auth/signin.js.map +1 -1
  42. package/dist-client/entries/auth/signup.d.ts +3 -1
  43. package/dist-client/entries/auth/signup.js +32 -2
  44. package/dist-client/entries/auth/signup.js.map +1 -1
  45. package/dist-client/entries/auth/unlock-user.d.ts +1 -1
  46. package/dist-client/entries/auth/unlock-user.js +1 -1
  47. package/dist-client/entries/auth/unlock-user.js.map +1 -1
  48. package/dist-client/entries/oauth2/oauth2-decision-page.d.ts +1 -1
  49. package/dist-client/entries/oauth2/oauth2-decision-page.js +1 -1
  50. package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -1
  51. package/dist-client/entries/public/home.js +2 -2
  52. package/dist-client/entries/public/home.js.map +1 -1
  53. package/dist-client/pages/application/application.js +1 -1
  54. package/dist-client/pages/application/application.js.map +1 -1
  55. package/dist-client/pages/domain/domain-management.d.ts +1 -1
  56. package/dist-client/pages/domain/domain-management.js +1 -1
  57. package/dist-client/pages/domain/domain-management.js.map +1 -1
  58. package/dist-client/pages/domain-link/domain-link-management.d.ts +53 -0
  59. package/dist-client/pages/domain-link/domain-link-management.js +353 -0
  60. package/dist-client/pages/domain-link/domain-link-management.js.map +1 -0
  61. package/dist-client/pages/partner/partner-management.d.ts +3 -3
  62. package/dist-client/pages/partner/partner-management.js +3 -3
  63. package/dist-client/pages/partner/partner-management.js.map +1 -1
  64. package/dist-client/pages/profile.d.ts +1 -1
  65. package/dist-client/pages/profile.js +1 -1
  66. package/dist-client/pages/profile.js.map +1 -1
  67. package/dist-client/pages/role/role-management.d.ts +3 -3
  68. package/dist-client/pages/role/role-management.js +3 -3
  69. package/dist-client/pages/role/role-management.js.map +1 -1
  70. package/dist-client/pages/user/user-management.d.ts +4 -4
  71. package/dist-client/pages/user/user-management.js +4 -4
  72. package/dist-client/pages/user/user-management.js.map +1 -1
  73. package/dist-client/route.js +3 -0
  74. package/dist-client/route.js.map +1 -1
  75. package/dist-client/tsconfig.tsbuildinfo +1 -1
  76. package/dist-server/tsconfig.tsbuildinfo +1 -1
  77. package/helps/auth/domain-link.md +178 -0
  78. package/package.json +12 -12
  79. package/things-factory.config.js +2 -1
  80. package/translations/en.json +7 -0
  81. package/translations/ja.json +7 -0
  82. package/translations/ko.json +7 -0
  83. package/translations/ms.json +7 -0
  84. package/translations/zh.json +7 -0
  85. package/client/auth-style-sign.ts +0 -194
  86. package/client/bootstrap.ts +0 -55
  87. package/client/components/abstract-auth-page.ts +0 -301
  88. package/client/components/abstract-password-reset.ts +0 -163
  89. package/client/components/abstract-sign.ts +0 -127
  90. package/client/components/change-password.ts +0 -153
  91. package/client/components/contact-us.ts +0 -116
  92. package/client/components/create-domain-popup.ts +0 -141
  93. package/client/components/create-role.ts +0 -123
  94. package/client/components/create-user.ts +0 -117
  95. package/client/components/credential-manager.ts +0 -64
  96. package/client/components/delete-user-popup.ts +0 -117
  97. package/client/components/domain-switch.ts +0 -127
  98. package/client/components/invite-customer.ts +0 -104
  99. package/client/components/invite-user.ts +0 -104
  100. package/client/components/my-login-history.ts +0 -101
  101. package/client/components/ownership-transfer-popup.ts +0 -110
  102. package/client/components/partner-info-card.ts +0 -89
  103. package/client/components/partner-role-editor.ts +0 -153
  104. package/client/components/profile-component.ts +0 -392
  105. package/client/components/role-edit-form.ts +0 -92
  106. package/client/components/role-privilege-editor.ts +0 -267
  107. package/client/components/role-selector.ts +0 -102
  108. package/client/components/user-role-editor.ts +0 -499
  109. package/client/constants/application.ts +0 -9
  110. package/client/constants/index.ts +0 -1
  111. package/client/entries/auth/activate.ts +0 -272
  112. package/client/entries/auth/checkin.ts +0 -183
  113. package/client/entries/auth/forgot-password.ts +0 -104
  114. package/client/entries/auth/reset-password.ts +0 -22
  115. package/client/entries/auth/result.ts +0 -193
  116. package/client/entries/auth/signin.ts +0 -18
  117. package/client/entries/auth/signup.ts +0 -115
  118. package/client/entries/auth/unlock-user.ts +0 -22
  119. package/client/entries/oauth2/oauth2-decision-error-page.ts +0 -50
  120. package/client/entries/oauth2/oauth2-decision-page.ts +0 -196
  121. package/client/entries/public/home.ts +0 -246
  122. package/client/index.ts +0 -124
  123. package/client/pages/app-binding/app-binding.ts +0 -423
  124. package/client/pages/app-binding/app-bindings.ts +0 -171
  125. package/client/pages/appliance/appliance.ts +0 -452
  126. package/client/pages/appliance/home.ts +0 -177
  127. package/client/pages/appliance/register.ts +0 -183
  128. package/client/pages/application/application.ts +0 -428
  129. package/client/pages/application/applications.ts +0 -182
  130. package/client/pages/application/register.ts +0 -211
  131. package/client/pages/attribute/attribute-set-item-list.ts +0 -237
  132. package/client/pages/attribute/attribute-set-management.ts +0 -282
  133. package/client/pages/auth-provider/auth-provider-management.ts +0 -381
  134. package/client/pages/domain/domain-management.ts +0 -431
  135. package/client/pages/partner/partner-management.ts +0 -112
  136. package/client/pages/profile.ts +0 -32
  137. package/client/pages/role/role-management.ts +0 -134
  138. package/client/pages/user/user-management.ts +0 -223
  139. package/client/route.ts +0 -67
  140. package/client/themes/auth-theme.css +0 -65
  141. package/client/utils/password-rule.ts +0 -37
  142. package/server/index.ts +0 -0
@@ -1,392 +0,0 @@
1
- import '@operato/i18n/ox-i18n.js'
2
- import '@operato/i18n/ox-i18n-selector.js'
3
- import './change-password'
4
- import './delete-user-popup'
5
- import './my-login-history'
6
-
7
- import { gql } from 'graphql-tag'
8
- import { css, html, LitElement, nothing } from 'lit'
9
- import { customElement, property, query, state } from 'lit/decorators.js'
10
- import { startRegistration } from '@simplewebauthn/browser'
11
-
12
- import { client } from '@operato/graphql'
13
- import { i18next, localize } from '@operato/i18n'
14
- import { notify, openPopup } from '@operato/layout'
15
- import { auth, getLanguages } from '@things-factory/auth-base/dist-client'
16
-
17
- const isAvailableWebauthn = 'PublicKeyCredential' in window
18
- @customElement('profile-component')
19
- export class ProfileComponent extends localize(i18next)(LitElement) {
20
- static styles = [
21
- css`
22
- :host {
23
- display: block;
24
- background-color: var(--md-sys-color-background);
25
- padding: 15px 0;
26
- }
27
- .wrap {
28
- max-width: var(--profile-wrap-max-width, 400px);
29
- margin: auto;
30
- display: grid;
31
- grid-template-columns: 1fr 1fr;
32
- }
33
-
34
- * {
35
- box-sizing: border-box;
36
- }
37
-
38
- *:focus {
39
- outline: none;
40
- }
41
-
42
- input {
43
- margin: var(--spacing-small) 0;
44
- border: 1px solid rgba(0, 0, 0, 0.2);
45
- padding: 9px;
46
- border-radius: var(--border-radius);
47
- font: var(--auth-input-field-font);
48
- width: var(--auth-input-field-width);
49
- }
50
- input:focus {
51
- border: 1px solid var(--focus-background-color);
52
- }
53
-
54
- .user {
55
- background: url(/assets/images/icon-profile.png) center top no-repeat;
56
- margin: var(--profile-icon-margin);
57
- padding: 180px 20px 20px 20px;
58
- color: var(--md-sys-color-secondary);
59
- font: var(--header-bar-title);
60
- text-align: center;
61
- }
62
-
63
- hr {
64
- width: 100%;
65
- border: dotted 1px rgba(0, 0, 0, 0.1);
66
- }
67
-
68
- .wrap * {
69
- grid-column: span 2;
70
- }
71
-
72
- label {
73
- font: bold 14px var(--theme-font);
74
- color: var(--md-sys-color-primary);
75
- text-transform: capitalize;
76
- grid-column: 1;
77
- }
78
-
79
- .wrap *.inline {
80
- grid-column: unset;
81
- }
82
-
83
- ox-i18n-selector {
84
- --i18n-selector-field-width: var(--auth-input-field-width);
85
- --i18n-selector-field-margin: var(--change-password-field-margin);
86
- --i18n-selector-field-padding: var(--spacing-medium);
87
- --i18n-selector-field-border-radius: var(--border-radius);
88
- margin: var(--change-password-field-margin);
89
- }
90
-
91
- md-text-button {
92
- text-transform: capitalize;
93
- }
94
-
95
- footer {
96
- padding: 20px;
97
- text-align: center;
98
- }
99
-
100
- footer p {
101
- font-size: 14px;
102
- margin-bottom: 5px;
103
- color: var(--md-sys-color-on-background);
104
- }
105
-
106
- footer a {
107
- color: var(--md-sys-color-primary);
108
- text-decoration: none;
109
- font-weight: bold;
110
- }
111
- `
112
- ]
113
-
114
- @property({ type: String }) username?: string
115
- @property({ type: String }) email?: string
116
- @property({ type: String }) name?: string
117
-
118
- @state() languages: { code: string; display: string }[] = []
119
- @state() passwordRule: {
120
- lowerCase?: boolean
121
- upperCase?: boolean
122
- digit?: boolean
123
- specialCharacter?: boolean
124
- allowRepeat?: boolean
125
- useTightPattern?: boolean
126
- useLoosePattern?: boolean
127
- tightCharacterLength?: number
128
- looseCharacterLength?: number
129
- } = {}
130
-
131
- @query('#username') usernameEl!: HTMLInputElement
132
- @query('#name') nameEl!: HTMLInputElement
133
- @query('#email') emailEl!: HTMLInputElement
134
- @query('#locale') localeEl!: HTMLInputElement
135
-
136
- async connectedCallback(): Promise<void> {
137
- super.connectedCallback()
138
-
139
- const response = await client.query({
140
- query: gql`
141
- query {
142
- passwordRule {
143
- lowerCase
144
- upperCase
145
- digit
146
- specialCharacter
147
- allowRepeat
148
- useTightPattern
149
- useLoosePattern
150
- tightCharacterLength
151
- looseCharacterLength
152
- }
153
- }
154
- `
155
- })
156
-
157
- this.passwordRule = response.data
158
- }
159
-
160
- async firstUpdated() {
161
- auth.on('profile', ({ credential }) => {
162
- this.setCredential(credential)
163
- })
164
-
165
- this.setCredential(auth.credential)
166
-
167
- this.languages = await getLanguages()
168
- }
169
-
170
- setCredential(credential) {
171
- if (credential) {
172
- this.username = credential.username
173
- this.name = credential.name
174
- this.email = credential.email
175
- } else {
176
- this.username = ''
177
- this.name = ''
178
- this.email = ''
179
- }
180
- }
181
-
182
- render() {
183
- return html`
184
- <div class="wrap">
185
- <div class="user">${this.username || ''}</div>
186
-
187
- <label for="username"><ox-i18n slot="title" msgid="label.user-id"></ox-i18n></label>
188
- <input id="username" @change=${e => this.onUsernameChanged(e.target.value)} .value=${this.username || ''} />
189
-
190
- <hr />
191
-
192
- <label for="name"><ox-i18n slot="title" msgid="label.name"></ox-i18n></label>
193
- <input id="name" @change=${e => this.onNameChanged(e.target.value)} .value=${this.name || ''} />
194
-
195
- <hr />
196
-
197
- <label for="email"><ox-i18n slot="title" msgid="label.email"></ox-i18n></label>
198
- <input id="email" type="email" @change=${e => this.onEmailChanged(e.target.value)} .value=${this.email || ''} />
199
-
200
- <hr />
201
-
202
- <label for="locale"><ox-i18n slot="title" msgid="label.language"></ox-i18n></label>
203
- <ox-i18n-selector
204
- id="locale"
205
- @change=${e => this.onLocaleChanged(e.detail)}
206
- value=${i18next.language || 'en-US'}
207
- .languages=${this.languages}
208
- ></ox-i18n-selector>
209
-
210
- <hr />
211
-
212
- <label for="change-password">
213
- <ox-i18n msgid="label.password"></ox-i18n>
214
- </label>
215
-
216
- <change-password id="change-password" .passwordRule=${this.passwordRule}></change-password>
217
-
218
- ${isAvailableWebauthn
219
- ? html`
220
- <md-text-button @click=${() => this.registerUser()}
221
- >${i18next.t('button.security-key registration')}</md-text-button
222
- >
223
- `
224
- : nothing}
225
-
226
- <footer>
227
- <p>
228
- ${i18next.t('text.click login history')}
229
- <a href="javascript:void(0);" @click=${this.openLoginHistory.bind(this)}
230
- >${i18next.t('label.login_history')}</a
231
- >
232
- </p>
233
- </footer>
234
- </div>
235
- `
236
- }
237
-
238
- async onUsernameChanged(username) {
239
- if (!username) return
240
-
241
- var oldUsername = this.username
242
-
243
- try {
244
- const message = await auth.updateProfile({
245
- username
246
- })
247
-
248
- notify({
249
- level: 'info',
250
- message
251
- })
252
- } catch (e: any) {
253
- this.usernameEl.value = oldUsername || ''
254
-
255
- notify({
256
- level: 'error',
257
- message: 'message' in e ? e.message : e
258
- })
259
- }
260
- }
261
-
262
- async onNameChanged(name) {
263
- if (!name) return
264
-
265
- var oldName = this.name
266
-
267
- try {
268
- const message = await auth.updateProfile({
269
- name
270
- })
271
-
272
- notify({
273
- level: 'info',
274
- message
275
- })
276
- } catch (e: any) {
277
- this.nameEl.value = oldName || ''
278
-
279
- notify({
280
- level: 'error',
281
- message: 'message' in e ? e.message : e
282
- })
283
- }
284
- }
285
-
286
- async onEmailChanged(email) {
287
- if (!email) return
288
-
289
- var oldEmail = this.email
290
-
291
- try {
292
- const message = await auth.updateProfile({
293
- email
294
- })
295
-
296
- notify({
297
- level: 'info',
298
- message
299
- })
300
- } catch (e: any) {
301
- this.emailEl.value = oldEmail || ''
302
-
303
- notify({
304
- level: 'error',
305
- message: 'message' in e ? e.message : e
306
- })
307
- }
308
- }
309
-
310
- async onLocaleChanged(value) {
311
- if (!value) return
312
-
313
- var oldLocale = i18next.language
314
-
315
- try {
316
- const message = await auth.updateProfile({
317
- locale: value
318
- })
319
-
320
- i18next.changeLanguage(value)
321
-
322
- notify({
323
- level: 'info',
324
- message
325
- })
326
- } catch (e: any) {
327
- this.localeEl.value = oldLocale
328
-
329
- notify({
330
- level: 'error',
331
- message: 'message' in e ? e.message : e
332
- })
333
- }
334
- }
335
-
336
- openLoginHistory() {
337
- openPopup(html` <my-login-history></my-login-history> `, {
338
- title: i18next.t('label.login_history')
339
- })
340
- }
341
-
342
- deleteUser() {
343
- openPopup(html` <delete-user-popup></delete-user-popup> `, {
344
- title: i18next.t('label.delete account')
345
- })
346
- }
347
-
348
- async registerUser() {
349
- try {
350
- const options = await fetch('/auth/register-webauthn/challenge').then(res => res.json())
351
- const attResp = await startRegistration(options)
352
- const verification = await fetch('/auth/verify-registration', {
353
- method: 'POST',
354
- headers: {
355
- 'Content-Type': 'application/json'
356
- },
357
- body: JSON.stringify(attResp)
358
- }).then(res => res.json())
359
-
360
- if (verification.verified) {
361
- notify({
362
- level: 'info',
363
- message: i18next.t('text.user credential registered successfully')
364
- })
365
- } else {
366
- console.error(await verification.text())
367
-
368
- notify({
369
- level: 'error',
370
- message: i18next.t('error.user credential registeration not allowed')
371
- })
372
- }
373
- } catch (error) {
374
- notify({
375
- level: 'error',
376
- message: i18next.t('error.user credential registeration failed')
377
- })
378
- }
379
- }
380
-
381
- get applicationMeta() {
382
- var iconLink: HTMLLinkElement | null = document.querySelector('link[rel="application-icon"]')
383
- var titleMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-name"]')
384
- var descriptionMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-description"]')
385
-
386
- return {
387
- icon: iconLink?.href || '',
388
- title: titleMeta?.content || 'Things Factory',
389
- description: descriptionMeta?.content || 'Reimagining Software'
390
- }
391
- }
392
- }
@@ -1,92 +0,0 @@
1
- import { css, html, LitElement } from 'lit'
2
- import { customElement, property, query } from 'lit/decorators.js'
3
-
4
- import { i18next, localize } from '@operato/i18n'
5
-
6
- @customElement('role-edit-form')
7
- class RoleEditForm extends localize(i18next)(LitElement) {
8
- static styles = css`
9
- [field-2column] {
10
- border-radius: var(--border-radius);
11
- display: grid;
12
- grid-template-columns: 1fr 1fr;
13
- gap: 5px 15px;
14
- clear: both;
15
- max-width: var(--input-container-max-width);
16
- }
17
- [field] {
18
- display: flex;
19
- flex-direction: column;
20
- padding-bottom: var(--spacing-medium);
21
- }
22
- input {
23
- border: var(--border-dim-color);
24
- border-radius: var(--border-radius);
25
- margin: var(--input-margin);
26
- padding: var(--input-padding);
27
- min-width: 250px;
28
- font: var(--input-font);
29
- }
30
- label {
31
- display: flex;
32
- flex-direction: column;
33
- font: var(--label-font);
34
- color: var(--md-sys-color-on-primary);
35
- text-transform: var(--label-text-transform);
36
- }
37
- @media screen and (max-width: 480px) {
38
- [field] {
39
- grid-column: span 2;
40
- }
41
- }
42
- `
43
- @property({ type: Object }) role: any
44
-
45
- render() {
46
- const role = this.role || { name: '', description: '' }
47
-
48
- return html`
49
- <form field-2column @input="${this.dispatchRoleChanged.bind(this)}">
50
- <div field>
51
- <label
52
- >role name
53
- <input name="name" value="${role.name}" @click="${e => e.stopPropagation()}" />
54
- </label>
55
- </div>
56
-
57
- <div field>
58
- <label
59
- >role description
60
- <input name="description" .value="${role.description}" @click="${e => e.stopPropagation()}" />
61
- </label>
62
- </div>
63
- </form>
64
- `
65
- }
66
-
67
- @query('input[name=name]') nameInput!: HTMLInputElement
68
- @query('input[name=description]') descriptionInput!: HTMLInputElement
69
-
70
- getRole() {
71
- const name = this.nameInput.value
72
- const description = this.descriptionInput.value
73
-
74
- if (!name) {
75
- return this.showToast(i18next.t('error.value is empty', { value: i18next.t('field.name') }))
76
- }
77
-
78
- return { name, description }
79
- }
80
-
81
- dispatchRoleChanged() {
82
- this.dispatchEvent(
83
- new CustomEvent('roleChanged', {
84
- detail: this.getRole()
85
- })
86
- )
87
- }
88
-
89
- showToast(message) {
90
- document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
91
- }
92
- }