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