@things-factory/auth-ui 8.0.0-beta.1 → 8.0.0-beta.2

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 (59) hide show
  1. package/package.json +4 -4
  2. package/client/auth-style-sign.ts +0 -194
  3. package/client/bootstrap.ts +0 -51
  4. package/client/components/abstract-auth-page.ts +0 -301
  5. package/client/components/abstract-password-reset.ts +0 -163
  6. package/client/components/abstract-sign.ts +0 -127
  7. package/client/components/change-password.ts +0 -153
  8. package/client/components/contact-us.ts +0 -116
  9. package/client/components/create-domain-popup.ts +0 -141
  10. package/client/components/create-role.ts +0 -123
  11. package/client/components/create-user.ts +0 -117
  12. package/client/components/credential-manager.ts +0 -64
  13. package/client/components/delete-user-popup.ts +0 -117
  14. package/client/components/domain-switch.ts +0 -127
  15. package/client/components/invite-customer.ts +0 -104
  16. package/client/components/invite-user.ts +0 -104
  17. package/client/components/my-login-history.ts +0 -101
  18. package/client/components/ownership-transfer-popup.ts +0 -110
  19. package/client/components/partner-info-card.ts +0 -89
  20. package/client/components/partner-role-editor.ts +0 -153
  21. package/client/components/profile-component.ts +0 -392
  22. package/client/components/role-edit-form.ts +0 -92
  23. package/client/components/role-privilege-editor.ts +0 -268
  24. package/client/components/role-selector.ts +0 -102
  25. package/client/components/user-role-editor.ts +0 -499
  26. package/client/constants/application.ts +0 -9
  27. package/client/constants/index.ts +0 -1
  28. package/client/entries/auth/activate.ts +0 -272
  29. package/client/entries/auth/checkin.ts +0 -190
  30. package/client/entries/auth/forgot-password.ts +0 -112
  31. package/client/entries/auth/reset-password.ts +0 -22
  32. package/client/entries/auth/result.ts +0 -193
  33. package/client/entries/auth/signin.ts +0 -18
  34. package/client/entries/auth/signup.ts +0 -115
  35. package/client/entries/auth/unlock-user.ts +0 -22
  36. package/client/entries/oauth2/oauth2-decision-error-page.ts +0 -50
  37. package/client/entries/oauth2/oauth2-decision-page.ts +0 -196
  38. package/client/entries/public/home.ts +0 -246
  39. package/client/index.ts +0 -124
  40. package/client/pages/app-binding/app-binding.ts +0 -423
  41. package/client/pages/app-binding/app-bindings.ts +0 -171
  42. package/client/pages/appliance/appliance.ts +0 -452
  43. package/client/pages/appliance/home.ts +0 -177
  44. package/client/pages/appliance/register.ts +0 -183
  45. package/client/pages/application/application.ts +0 -428
  46. package/client/pages/application/applications.ts +0 -182
  47. package/client/pages/application/register.ts +0 -211
  48. package/client/pages/attribute/attribute-set-item-list.ts +0 -237
  49. package/client/pages/attribute/attribute-set-management.ts +0 -282
  50. package/client/pages/auth-provider/auth-provider-management.ts +0 -381
  51. package/client/pages/domain/domain-management.ts +0 -410
  52. package/client/pages/partner/partner-management.ts +0 -112
  53. package/client/pages/profile.ts +0 -32
  54. package/client/pages/role/role-management.ts +0 -134
  55. package/client/pages/user/user-management.ts +0 -223
  56. package/client/route.ts +0 -67
  57. package/client/themes/auth-theme.css +0 -65
  58. package/client/utils/password-rule.ts +0 -37
  59. package/server/index.ts +0 -0
@@ -1,268 +0,0 @@
1
- import gql from 'graphql-tag'
2
- import { css, html, LitElement } from 'lit'
3
- import { customElement, property, state } from 'lit/decorators.js'
4
-
5
- import { client, gqlContext } from '@operato/graphql'
6
- import { i18next, localize } from '@operato/i18n'
7
- import { OxPrompt } from '@operato/popup/ox-prompt.js'
8
- import { ButtonContainerStyles } from '@operato/styles'
9
-
10
- @customElement('role-privilege-editor')
11
- class RolePrivilegeEditor extends localize(i18next)(LitElement) {
12
- static styles = [
13
- ButtonContainerStyles,
14
- css`
15
- :host {
16
- display: flex;
17
- flex-direction: column;
18
-
19
- border: 1px solid var(--md-sys-color-primary);
20
- font: normal 15px var(--theme-font);
21
- }
22
-
23
- div {
24
- margin: var(--spacing-medium);
25
- }
26
-
27
- div[users] {
28
- margin: 0;
29
- background-color: var(--md-sys-color-surface-variant);
30
- }
31
-
32
- div[titler] {
33
- color: var(--md-sys-color-secondary);
34
- font: bold 1.2em var(--theme-font);
35
- text-transform: capitalize;
36
- }
37
-
38
- ul {
39
- flex: 1;
40
- color: var(--md-sys-color-secondary);
41
- background-color: var(--md-sys-color-surface-variant);
42
- overflow: auto;
43
- display: grid;
44
- grid-template-columns: 1fr 1fr;
45
- margin-block-start: 0;
46
- margin-block-end: 0;
47
- padding: var(--spacing-medium);
48
- list-style: none;
49
- border: 1px dashed rgba(0, 0, 0, 0.1);
50
- border-width: 1px 0;
51
- }
52
-
53
- input[type='checkbox'] {
54
- display: inline;
55
- }
56
-
57
- li {
58
- padding: var(--spacing-small);
59
- }
60
-
61
- #checkAll,
62
- [for='checkAll'] {
63
- margin-bottom: var(--spacing-medium);
64
- padding-bottom: var(--spacing-small);
65
- font-weight: bold;
66
- }
67
-
68
- md-elevated-button {
69
- margin: 5px;
70
- background-color: var(--md-sys-color-surface-variant);
71
- }
72
-
73
- md-outlined-button {
74
- background-color: var(--md-sys-color-surface-variant);
75
- }
76
-
77
- @media screen and (max-width: 480px) {
78
- ul {
79
- grid-template-columns: 1fr;
80
- }
81
- }
82
- `
83
- ]
84
-
85
- @property({ type: Object }) role: any
86
- @property({ type: Array }) allPrivileges: any[] = []
87
- @property({ type: Object }) updateRoleObj: any
88
-
89
- @state() privileges: { id: string; description: string }[] = []
90
- @state() users: { /* id: string; username: string; */ name: string; email: string }[] = []
91
-
92
- render() {
93
- const allPrivileges = this.allPrivileges || []
94
- const privileges = this.privileges || []
95
- const users = this.users || []
96
-
97
- return html`
98
- <div titler>${String(i18next.t('label.user'))}</div>
99
-
100
- <div users>${users.map(user => html`<div>${user.name} (${user.email})</div>`)}</div>
101
-
102
- <div titler>${String(i18next.t('field.privileges'))}</div>
103
-
104
- <div>
105
- <input id="checkAll" type="checkbox" @change=${e => this.oncheckAll(e)} />
106
- <label for="checkAll">Check all</label>
107
- </div>
108
-
109
- <ul privileges>
110
- ${allPrivileges.map(
111
- privilege => html`
112
- <li>
113
- <input
114
- type="checkbox"
115
- id="${privilege.id}"
116
- .checked=${privileges.map(p => p.id).indexOf(privilege.id) > -1}
117
- .data-privilege=${privilege}
118
- />
119
- <label for="${privilege.id}">${privilege.description}</label>
120
- </li>
121
- `
122
- )}
123
- </ul>
124
-
125
- <div class="button-container">
126
- <md-elevated-button @click=${e => this.onSave()}>${String(i18next.t('button.save'))}</md-elevated-button>
127
- <md-elevated-button @click=${e => this.onDeleteRole()} danger
128
- >${String(i18next.t('button.delete role'))}</md-elevated-button
129
- >
130
- </div>
131
- `
132
- }
133
-
134
- async firstUpdated() {
135
- this.allPrivileges = await this.fetchPrivileges()
136
- }
137
-
138
- async updated(changes) {
139
- if (changes.has('role')) {
140
- await this.fetchPrivilegesOnRole(this.role.name)
141
- }
142
- }
143
-
144
- checkAll(checked) {
145
- Array.from(this.renderRoot.querySelectorAll('ul[privileges] input[type=checkbox]')).forEach(
146
- checkbox => ((checkbox as HTMLInputElement).checked = checked)
147
- )
148
- }
149
-
150
- oncheckAll(e) {
151
- this.checkAll(e.target.checked)
152
- }
153
-
154
- async onSave() {
155
- const updateRoleObj = this.updateRoleObj
156
- const privileges = Array.from(this.renderRoot.querySelectorAll('ul[privileges] input[type=checkbox]:checked')).map(
157
- e => e['data-privilege']
158
- )
159
-
160
- const patch = { ...updateRoleObj, privileges: privileges }
161
-
162
- if (this.role) {
163
- const response = await client.mutate({
164
- mutation: gql`
165
- mutation ($id: String!, $patch: RolePatch!) {
166
- updateRole(id: $id, patch: $patch) {
167
- id
168
- name
169
- description
170
- privileges {
171
- id
172
- description
173
- }
174
- }
175
- }
176
- `,
177
- variables: { id: this.role.id, patch },
178
- context: gqlContext()
179
- })
180
-
181
- if (!response.errors) {
182
- await this.dispatchEvent(new CustomEvent('fetch-roles'))
183
- this.showToast(i18next.t('text.data_updated_successfully'))
184
- }
185
- }
186
- }
187
-
188
- async onDeleteRole() {
189
- if (
190
- await OxPrompt.open({
191
- title: i18next.t('text.are_you_sure'),
192
- text: i18next.t('text.are_you_sure_to_delete_x', { x: i18next.t('label.role') }),
193
- confirmButton: { text: i18next.t('button.delete') },
194
- cancelButton: { text: i18next.t('button.cancel') }
195
- })
196
- ) {
197
- const response = await client.mutate({
198
- mutation: gql`
199
- mutation ($id: String!) {
200
- deleteRole(id: $id)
201
- }
202
- `,
203
- variables: { id: this.role.id },
204
- context: gqlContext()
205
- })
206
-
207
- if (!response.errors) {
208
- await this.dispatchEvent(new CustomEvent('fetch-roles'))
209
-
210
- await OxPrompt.open({
211
- type: 'success',
212
- title: i18next.t('text.completed'),
213
- text: i18next.t('text.x_deleted_successfully', { x: i18next.t('label.role') }),
214
- confirmButton: { text: i18next.t('button.confirm') }
215
- })
216
- }
217
- }
218
- }
219
-
220
- async fetchPrivileges() {
221
- const response = await client.query({
222
- query: gql`
223
- query privileges {
224
- privileges {
225
- items {
226
- id
227
- name
228
- description
229
- }
230
- total
231
- }
232
- }
233
- `
234
- })
235
-
236
- return response.data.privileges.items
237
- }
238
-
239
- async fetchPrivilegesOnRole(name) {
240
- const response = await client.query({
241
- query: gql`
242
- query ($name: String!) {
243
- role(name: $name) {
244
- id
245
- name
246
- privileges {
247
- id
248
- description
249
- }
250
- users {
251
- name
252
- email
253
- }
254
- }
255
- }
256
- `,
257
- variables: { name },
258
- context: gqlContext()
259
- })
260
-
261
- this.privileges = response.data.role?.privileges
262
- this.users = response.data.role?.users
263
- }
264
-
265
- showToast(message) {
266
- document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
267
- }
268
- }
@@ -1,102 +0,0 @@
1
- import { css, html, LitElement, nothing } from 'lit'
2
- import { customElement, property } from 'lit/decorators.js'
3
-
4
- @customElement('role-selector')
5
- export class RoleSelector extends LitElement {
6
- static styles = [
7
- css`
8
- [subtitle] {
9
- margin: 0;
10
- padding: var(--subtitle-padding);
11
- font: var(--subtitle-font);
12
- color: var(--subtitle-text-color);
13
- }
14
- div {
15
- margin: 0 var(--spacing-medium) var(--spacing-medium) var(--spacing-medium);
16
- }
17
- ul {
18
- flex: 1;
19
- display: grid;
20
- grid-template-columns: 1fr 1fr;
21
- column-gap: 20px;
22
- overflow: auto;
23
- margin: 0;
24
- padding: var(--spacing-medium);
25
- list-style: none;
26
- border: 1px dashed rgba(0, 0, 0, 0.1);
27
- border-width: 1px 0;
28
- }
29
- input[type='checkbox'] {
30
- display: inline;
31
- }
32
- label {
33
- padding-left: var(--spacing-small);
34
- text-transform: capitalize;
35
- font: var(--label-font);
36
- color: var(--label-color, var(--md-sys-color-on-surface));
37
- }
38
- li {
39
- padding: var(--spacing-small);
40
- }
41
- #checkAll,
42
- [for='checkAll'] {
43
- margin-bottom: var(--spacing-medium);
44
- padding-bottom: var(--spacing-small);
45
- font-weight: bold;
46
- }
47
- `
48
- ]
49
-
50
- @property({ type: String }) roleCategory: string = 'Roles'
51
- @property({ type: Object }) user: any = {}
52
- @property({ type: Array }) roles: any[] = []
53
- @property({ type: Array }) userRoles: any[] = []
54
-
55
- render() {
56
- const userRoleIds = (this.userRoles || []).map(userRole => userRole.id)
57
-
58
- return html`
59
- ${this.roles.length
60
- ? html`
61
- <div>
62
- ${this.roleCategory ? html`<h3 subtitle>${this.roleCategory}</h3>` : nothing}
63
- <input id="checkAll" type="checkbox" @change=${this.checkAll.bind(this)} />
64
- <label for="checkAll">Check all</label>
65
- </div>
66
-
67
- <ul roles>
68
- ${this.roles.map(
69
- role => html`
70
- <li>
71
- <input
72
- id="${role.id}"
73
- type="checkbox"
74
- .checked=${userRoleIds.indexOf(role.id) >= 0}
75
- .data-role=${role}
76
- />
77
- <label for="${role.id}">${role.name}</label>
78
- </li>
79
- `
80
- )}
81
- </ul>
82
- `
83
- : ''}
84
- `
85
- }
86
-
87
- checkAll(e) {
88
- const checked = e.currentTarget.checked
89
- Array.from(this.renderRoot.querySelectorAll('ul[roles] input[type=checkbox]')).forEach(
90
- checkbox => ((checkbox as HTMLInputElement).checked = checked)
91
- )
92
- }
93
-
94
- selectedRoles() {
95
- return Array.from(this.renderRoot.querySelectorAll('ul[roles] input[type=checkbox]'))
96
- .filter(input => (input as HTMLInputElement).checked)
97
- .map(input => {
98
- const { id, name } = input['data-role']
99
- return { id, name }
100
- })
101
- }
102
- }