@things-factory/auth-ui 6.2.6 → 6.2.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 (50) hide show
  1. package/client/components/abstract-auth-page.ts +16 -13
  2. package/client/components/create-domain-popup.ts +2 -2
  3. package/client/components/create-role.ts +38 -34
  4. package/client/components/create-user.ts +27 -52
  5. package/client/components/invite-customer.ts +29 -29
  6. package/client/components/invite-user.ts +15 -14
  7. package/client/components/ownership-transfer-popup.ts +29 -30
  8. package/client/components/partner-role-editor.ts +28 -28
  9. package/client/components/role-privilege-editor.ts +32 -31
  10. package/client/components/role-selector.ts +2 -2
  11. package/client/components/user-role-editor.ts +64 -66
  12. package/client/entries/auth/forgot-password.ts +1 -1
  13. package/client/entries/auth/signup.ts +15 -9
  14. package/client/entries/oauth2/oauth2-decision-page.ts +2 -2
  15. package/client/pages/role/role-management.ts +0 -1
  16. package/client/pages/user/user-management.ts +26 -26
  17. package/dist-client/components/abstract-auth-page.js +16 -14
  18. package/dist-client/components/abstract-auth-page.js.map +1 -1
  19. package/dist-client/components/create-domain-popup.js +2 -2
  20. package/dist-client/components/create-domain-popup.js.map +1 -1
  21. package/dist-client/components/create-role.js +30 -27
  22. package/dist-client/components/create-role.js.map +1 -1
  23. package/dist-client/components/create-user.js +26 -51
  24. package/dist-client/components/create-user.js.map +1 -1
  25. package/dist-client/components/invite-customer.js +24 -25
  26. package/dist-client/components/invite-customer.js.map +1 -1
  27. package/dist-client/components/invite-user.js +8 -9
  28. package/dist-client/components/invite-user.js.map +1 -1
  29. package/dist-client/components/ownership-transfer-popup.js +23 -23
  30. package/dist-client/components/ownership-transfer-popup.js.map +1 -1
  31. package/dist-client/components/partner-role-editor.js +21 -22
  32. package/dist-client/components/partner-role-editor.js.map +1 -1
  33. package/dist-client/components/role-privilege-editor.js +25 -25
  34. package/dist-client/components/role-privilege-editor.js.map +1 -1
  35. package/dist-client/components/role-selector.js +2 -2
  36. package/dist-client/components/role-selector.js.map +1 -1
  37. package/dist-client/components/user-role-editor.js +54 -58
  38. package/dist-client/components/user-role-editor.js.map +1 -1
  39. package/dist-client/entries/auth/forgot-password.js +1 -1
  40. package/dist-client/entries/auth/forgot-password.js.map +1 -1
  41. package/dist-client/entries/auth/signup.js +15 -9
  42. package/dist-client/entries/auth/signup.js.map +1 -1
  43. package/dist-client/entries/oauth2/oauth2-decision-page.js +2 -2
  44. package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -1
  45. package/dist-client/pages/role/role-management.js +0 -1
  46. package/dist-client/pages/role/role-management.js.map +1 -1
  47. package/dist-client/pages/user/user-management.js +19 -20
  48. package/dist-client/pages/user/user-management.js.map +1 -1
  49. package/dist-client/tsconfig.tsbuildinfo +1 -1
  50. package/package.json +4 -5
@@ -7,7 +7,7 @@ import '@operato/i18n/ox-i18n.js'
7
7
  import '@operato/i18n/ox-i18n-selector.js'
8
8
  import '@operato/layout/ox-snack-bar.js'
9
9
 
10
- import { css, html, LitElement } from 'lit'
10
+ import { css, html, LitElement, nothing } from 'lit'
11
11
  import { property, query } from 'lit/decorators.js'
12
12
 
13
13
  import { i18next, localize } from '@operato/i18n'
@@ -96,7 +96,7 @@ export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
96
96
  <form
97
97
  id="form"
98
98
  action="${this.actionUrl}"
99
- method="POST"
99
+ method="post"
100
100
  @keypress=${e => {
101
101
  if (e.key == 'Enter') this._onSubmit(e)
102
102
  }}
@@ -168,10 +168,10 @@ export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
168
168
  <mwc-textfield
169
169
  name="email"
170
170
  type="email"
171
- label=${i18next.t('field.email')}
171
+ label=${String(i18next.t('field.email'))}
172
172
  required
173
173
  .value=${email}
174
- .validationMessage=${i18next.t('text.invalid-email')}
174
+ .validationMessage=${String(i18next.t('text.invalid-email'))}
175
175
  autocomplete="username"
176
176
  autocapitalize="off"
177
177
  ></mwc-textfield>
@@ -180,7 +180,7 @@ export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
180
180
  <mwc-textfield
181
181
  name="password"
182
182
  type="password"
183
- label=${i18next.t('field.password')}
183
+ label=${String(i18next.t('field.password'))}
184
184
  autocomplete="current-password"
185
185
  required
186
186
  ></mwc-textfield>
@@ -193,16 +193,19 @@ export abstract class AbstractAuthPage extends localize(i18next)(LitElement) {
193
193
  }
194
194
 
195
195
  get links() {
196
- const ssoLinks = this.data?.ssoLinks || []
196
+ const { userSignupProcess = true, ssoLinks = [] } = this.data || {}
197
197
 
198
198
  return html`
199
- <a class="link" href="/auth/signup">
200
- <mwc-button icon="add_task"><ox-i18n msgid="field.sign up"></ox-i18n></mwc-button>
201
- </a>
202
- <a class="link" href="/auth/forgot-password">
203
- <mwc-button icon="lock_open"><ox-i18n msgid="field.forgot-password"></ox-i18n></mwc-button>
204
- </a>
205
-
199
+ ${userSignupProcess
200
+ ? html`
201
+ <a class="link" href="/auth/signup">
202
+ <mwc-button icon="add_task"><ox-i18n msgid="field.sign up"></ox-i18n></mwc-button>
203
+ </a>
204
+ <a class="link" href="/auth/forgot-password">
205
+ <mwc-button icon="lock_open"><ox-i18n msgid="field.forgot-password"></ox-i18n></mwc-button>
206
+ </a>
207
+ `
208
+ : nothing}
206
209
  ${ssoLinks.map(
207
210
  sso => html`
208
211
  <a class="link" href=${sso.link}>
@@ -6,7 +6,7 @@ import { customElement, query } from 'lit/decorators.js'
6
6
 
7
7
  import { client } from '@operato/graphql'
8
8
  import { i18next, localize } from '@operato/i18n'
9
- import { CustomAlert } from '@things-factory/shell/client'
9
+ import { OxPrompt } from '@operato/popup/ox-prompt.js'
10
10
 
11
11
  @customElement('create-domain-popup')
12
12
  class CreateDomainPopup extends localize(i18next)(LitElement) {
@@ -118,7 +118,7 @@ class CreateDomainPopup extends localize(i18next)(LitElement) {
118
118
  })
119
119
 
120
120
  if (!response.errors) {
121
- await CustomAlert({
121
+ await OxPrompt.open({
122
122
  type: 'success',
123
123
  title: i18next.t('text.completed'),
124
124
  text: i18next.t('text.x_created_successfully', { x: i18next.t('label.domain') }),
@@ -6,7 +6,7 @@ import { customElement, query } from 'lit/decorators.js'
6
6
 
7
7
  import { client, gqlContext } from '@operato/graphql'
8
8
  import { i18next, localize } from '@operato/i18n'
9
- import { CustomAlert } from '@things-factory/shell/client'
9
+ import { OxPrompt } from '@operato/popup/ox-prompt.js'
10
10
 
11
11
  @customElement('create-role')
12
12
  class CreateRole extends localize(i18next)(LitElement) {
@@ -53,15 +53,19 @@ class CreateRole extends localize(i18next)(LitElement) {
53
53
  <mwc-textfield
54
54
  type="text"
55
55
  name="name"
56
- label=${i18next.t('label.x name', { x: i18next.t('label.role') })}
56
+ label=${String(i18next.t('label.x name', { x: i18next.t('label.role') }))}
57
57
  ></mwc-textfield>
58
58
  <mwc-textfield
59
59
  type="text"
60
60
  name="description"
61
- label=${i18next.t('label.x description', { x: i18next.t('label.role') })}
61
+ label=${String(i18next.t('label.x description', { x: i18next.t('label.role') }))}
62
62
  ></mwc-textfield>
63
63
 
64
- <mwc-button @click=${this.onCreateRole.bind(this)} outlined label="${i18next.t('button.create')}"></mwc-button>
64
+ <mwc-button
65
+ @click=${this.onCreateRole.bind(this)}
66
+ outlined
67
+ label=${String(i18next.t('button.create'))}
68
+ ></mwc-button>
65
69
  `
66
70
  }
67
71
 
@@ -78,39 +82,39 @@ class CreateRole extends localize(i18next)(LitElement) {
78
82
  role.name = name
79
83
  role.description = description
80
84
 
81
- const result = await CustomAlert({
82
- title: i18next.t('text.are_you_sure'),
83
- text: i18next.t('text.do_you_want_to_create_x', { x: i18next.t('label.role') }),
84
- confirmButton: { text: i18next.t('button.confirm') },
85
- cancelButton: { text: i18next.t('button.cancel') }
86
- })
87
-
88
- if (!result.value) return
89
-
90
- const response = await client.mutate({
91
- mutation: gql`
92
- mutation createRole($role: NewRole!) {
93
- createRole(role: $role) {
94
- name
85
+ if (
86
+ await OxPrompt.open({
87
+ title: i18next.t('text.are_you_sure'),
88
+ text: i18next.t('text.do_you_want_to_create_x', { x: i18next.t('label.role') }),
89
+ confirmButton: { text: i18next.t('button.confirm') },
90
+ cancelButton: { text: i18next.t('button.cancel') }
91
+ })
92
+ ) {
93
+ const response = await client.mutate({
94
+ mutation: gql`
95
+ mutation createRole($role: NewRole!) {
96
+ createRole(role: $role) {
97
+ name
98
+ }
95
99
  }
96
- }
97
- `,
98
- variables: { role },
99
- context: gqlContext()
100
- })
101
-
102
- if (!response.errors) {
103
- await this.dispatchEvent(new CustomEvent('fetch-roles'))
104
-
105
- await CustomAlert({
106
- type: 'success',
107
- title: i18next.t('text.completed'),
108
- text: i18next.t('text.data_uploaded_successfully'),
109
- confirmButton: { text: i18next.t('button.confirm') }
100
+ `,
101
+ variables: { role },
102
+ context: gqlContext()
110
103
  })
111
104
 
112
- this.nameInput.value = ''
113
- this.descriptionInput.value = ''
105
+ if (!response.errors) {
106
+ await this.dispatchEvent(new CustomEvent('fetch-roles'))
107
+
108
+ await OxPrompt.open({
109
+ type: 'success',
110
+ title: i18next.t('text.completed'),
111
+ text: i18next.t('text.data_uploaded_successfully'),
112
+ confirmButton: { text: i18next.t('button.confirm') }
113
+ })
114
+
115
+ this.nameInput.value = ''
116
+ this.descriptionInput.value = ''
117
+ }
114
118
  }
115
119
  }
116
120
 
@@ -6,83 +6,58 @@ import { i18next } from '@operato/i18n'
6
6
  @customElement('create-user')
7
7
  class CreateUser extends LitElement {
8
8
  static styles = css`
9
- [field-2column] {
9
+ :host {
10
+ --mdc-text-field-fill-color: var(--theme-white-color);
10
11
  background-color: var(--theme-white-color);
11
12
  margin: var(--margin-wide) 0;
12
13
  padding: var(--padding-wide);
13
14
  border-radius: var(--border-radius);
14
15
  box-shadow: var(--box-shadow);
16
+
15
17
  display: grid;
16
- grid-template-columns: 1fr 1fr;
18
+ grid-template-columns: 1fr 2fr auto;
17
19
  gap: 5px 15px;
18
20
  clear: both;
19
21
  max-width: var(--input-container-max-width);
20
- }
21
- [field] {
22
- display: flex;
23
- flex-direction: column;
24
- padding-bottom: var(--padding-default);
25
- }
26
- [grid-span] {
27
- grid-column: span 2;
28
- }
29
22
 
30
- input {
31
- border: var(--border-dark-color);
32
- border-radius: var(--border-radius);
33
- margin: var(--input-margin);
34
- padding: var(--input-padding);
35
- min-width: 250px;
36
- font: var(--input-font);
23
+ align-items: center;
37
24
  }
38
- label {
39
- display: flex;
40
- flex-direction: column;
41
25
 
42
- font: var(--label-font);
43
- color: var(--label-color);
44
- text-transform: var(--label-text-transform);
45
- }
46
26
  mwc-button {
47
27
  margin: var(--input-margin);
48
28
  }
29
+
49
30
  @media screen and (max-width: 480px) {
50
- div {
51
- display: grid;
31
+ :host {
32
+ grid-template-columns: 1fr 1fr;
52
33
  }
53
- [field] {
34
+
35
+ mwc-button {
54
36
  grid-column: span 2;
37
+
38
+ margin: var(--input-margin);
55
39
  }
56
40
  }
57
41
  `
58
42
 
59
- @query('input[name=name]') nameInput!: HTMLInputElement
60
- @query('input[name=email]') emailInput!: HTMLInputElement
43
+ @query('[name=name]') nameInput!: HTMLInputElement
44
+ @query('[name=email]') emailInput!: HTMLInputElement
61
45
 
62
46
  render() {
63
47
  return html`
64
- <div field-2column>
65
- <div field>
66
- <label
67
- >${i18next.t('label.x name', { x: i18next.t('label.user') })}
68
- <input name="name" type="text" required />
69
- </label>
70
- </div>
71
- <div field>
72
- <label
73
- >${i18next.t('field.email')}
74
- <input name="email" type="email" required autocapitalize="off" />
75
- </label>
76
- </div>
77
-
78
- <div>
79
- <mwc-button
80
- @click=${this.onCreateUser.bind(this)}
81
- outlined
82
- label="${i18next.t('button.create')}"
83
- ></mwc-button>
84
- </div>
85
- </div>
48
+ <mwc-textfield
49
+ type="text"
50
+ name="name"
51
+ label=${String(i18next.t('label.x name', { x: i18next.t('label.user') }))}
52
+ ></mwc-textfield>
53
+
54
+ <mwc-textfield type="email" name="email" label=${String(i18next.t('field.email'))}></mwc-textfield>
55
+
56
+ <mwc-button
57
+ @click=${this.onCreateUser.bind(this)}
58
+ outlined
59
+ label=${String(i18next.t('button.create'))}
60
+ ></mwc-button>
86
61
  `
87
62
  }
88
63
 
@@ -6,7 +6,7 @@ import { customElement, property, query } from 'lit/decorators.js'
6
6
 
7
7
  import { client, gqlContext } from '@operato/graphql'
8
8
  import { i18next, localize } from '@operato/i18n'
9
- import { CustomAlert } from '@things-factory/shell/client'
9
+ import { OxPrompt } from '@operato/popup/ox-prompt.js'
10
10
 
11
11
  @customElement('invite-customer')
12
12
  class InviteCustomer extends localize(i18next)(LitElement) {
@@ -43,7 +43,7 @@ class InviteCustomer extends localize(i18next)(LitElement) {
43
43
  @click=${this.invite.bind(this)}
44
44
  outlined
45
45
  icon="group_add"
46
- label="${i18next.t('label.invite customer')}"
46
+ label=${String(i18next.t('label.invite customer'))}
47
47
  ></mwc-button>
48
48
  </div>
49
49
  `
@@ -60,39 +60,39 @@ class InviteCustomer extends localize(i18next)(LitElement) {
60
60
  )
61
61
  }
62
62
 
63
- const result = await CustomAlert({
64
- title: i18next.t('text.are_you_sure'),
65
- text: i18next.t('text.do_you_want_to_invite_x', { x: i18next.t(`label.partner`) }),
66
- confirmButton: { text: i18next.t('button.confirm') },
67
- cancelButton: { text: i18next.t('button.cancel') }
68
- })
63
+ if (
64
+ await OxPrompt.open({
65
+ title: i18next.t('text.are_you_sure'),
66
+ text: i18next.t('text.do_you_want_to_invite_x', { x: i18next.t(`label.partner`) }),
67
+ confirmButton: { text: i18next.t('button.confirm') },
68
+ cancelButton: { text: i18next.t('button.cancel') }
69
+ })
70
+ ) {
71
+ const customerDomainName = this.customerNameInput.value
69
72
 
70
- if (!result.value) return
73
+ const response = await client.mutate({
74
+ mutation: gql`
75
+ mutation inviteCustomer($customerDomainName: String!) {
76
+ inviteCustomer(customerDomainName: $customerDomainName)
77
+ }
78
+ `,
79
+ variables: { customerDomainName },
80
+ context: gqlContext()
81
+ })
71
82
 
72
- const customerDomainName = this.customerNameInput.value
83
+ if (!response.errors) {
84
+ const answer = this.dispatchEvent(new CustomEvent('invitationCompleted'))
73
85
 
74
- const response = await client.mutate({
75
- mutation: gql`
76
- mutation inviteCustomer($customerDomainName: String!) {
77
- inviteCustomer(customerDomainName: $customerDomainName)
86
+ if (answer) {
87
+ await OxPrompt.open({
88
+ type: 'success',
89
+ title: i18next.t('text.completed'),
90
+ confirmButton: { text: i18next.t('button.confirm') }
91
+ })
78
92
  }
79
- `,
80
- variables: { customerDomainName },
81
- context: gqlContext()
82
- })
83
93
 
84
- if (!response.errors) {
85
- const answer = this.dispatchEvent(new CustomEvent('invitationCompleted'))
86
-
87
- if (answer) {
88
- await CustomAlert({
89
- type: 'success',
90
- title: i18next.t('text.completed'),
91
- confirmButton: { text: i18next.t('button.confirm') }
92
- })
94
+ this.customerNameInput.value = ''
93
95
  }
94
-
95
- this.customerNameInput.value = ''
96
96
  }
97
97
  } catch (e: any) {
98
98
  document.dispatchEvent(
@@ -6,7 +6,7 @@ import { customElement, query } from 'lit/decorators.js'
6
6
 
7
7
  import { client, gqlContext } from '@operato/graphql'
8
8
  import { i18next, localize } from '@operato/i18n'
9
- import { CustomAlert } from '@things-factory/shell/client'
9
+ import { OxPrompt } from '@operato/popup/ox-prompt.js'
10
10
 
11
11
  @customElement('invite-user')
12
12
  class InviteUser extends localize(i18next)(LitElement) {
@@ -40,7 +40,7 @@ class InviteUser extends localize(i18next)(LitElement) {
40
40
  @click=${this.invite.bind(this)}
41
41
  outlined
42
42
  icon="group_add"
43
- label="${i18next.t('label.invite user')}"
43
+ label=${String(i18next.t('label.invite user'))}
44
44
  ></mwc-button>
45
45
  `
46
46
  }
@@ -51,18 +51,18 @@ class InviteUser extends localize(i18next)(LitElement) {
51
51
  throw new Error(i18next.t('error.not valid pattern of type', { type: 'e-mail' }))
52
52
  }
53
53
 
54
- const result = await CustomAlert({
55
- title: i18next.t('text.are_you_sure'),
56
- text: i18next.t('text.do_you_want_to_invite_x', { x: i18next.t(`label.user`) }),
57
- confirmButton: { text: i18next.t('button.confirm') },
58
- cancelButton: { text: i18next.t('button.cancel') }
59
- })
60
-
61
- if (!result.value) return
62
-
63
- await this.inviteUser(this.emailInput.value)
54
+ if (
55
+ await OxPrompt.open({
56
+ title: i18next.t('text.are_you_sure'),
57
+ text: i18next.t('text.do_you_want_to_invite_x', { x: i18next.t(`label.user`) }),
58
+ confirmButton: { text: i18next.t('button.confirm') },
59
+ cancelButton: { text: i18next.t('button.cancel') }
60
+ })
61
+ ) {
62
+ await this.inviteUser(this.emailInput.value)
64
63
 
65
- this.dispatchEvent(new CustomEvent('invitationCompleted'))
64
+ this.dispatchEvent(new CustomEvent('invitationCompleted'))
65
+ }
66
66
  } catch (e: any) {
67
67
  document.dispatchEvent(
68
68
  new CustomEvent('notify', {
@@ -87,10 +87,11 @@ class InviteUser extends localize(i18next)(LitElement) {
87
87
  })
88
88
 
89
89
  if (!response.errors) {
90
- await CustomAlert({
90
+ await OxPrompt.open({
91
91
  title: i18next.t('text.completed'),
92
92
  confirmButton: { text: i18next.t('button.confirm') }
93
93
  })
94
+
94
95
  this.emailInput.value = ''
95
96
  }
96
97
  }
@@ -6,7 +6,7 @@ import { customElement, property, query } from 'lit/decorators.js'
6
6
 
7
7
  import { client, gqlContext } from '@operato/graphql'
8
8
  import { i18next, localize } from '@operato/i18n'
9
- import { CustomAlert } from '@things-factory/shell/client'
9
+ import { OxPrompt } from '@operato/popup/ox-prompt.js'
10
10
 
11
11
  @customElement('ownership-transfer-popup')
12
12
  class OwnershipTransferPopup extends localize(i18next)(LitElement) {
@@ -65,39 +65,38 @@ class OwnershipTransferPopup extends localize(i18next)(LitElement) {
65
65
  return
66
66
  }
67
67
 
68
- const answer = await CustomAlert({
69
- title: i18next.t('text.are_you_sure'),
70
- text: i18next.t('text.are_you_sure_to_transfer_owner'),
71
- confirmButton: { text: i18next.t('button.confirm') },
72
- cancelButton: { text: i18next.t('button.cancel') }
73
- })
74
-
75
- if (!answer.value) {
76
- history.back()
77
- return
78
- }
68
+ if (
69
+ await OxPrompt.open({
70
+ title: i18next.t('text.are_you_sure'),
71
+ text: i18next.t('text.are_you_sure_to_transfer_owner'),
72
+ confirmButton: { text: i18next.t('button.confirm') },
73
+ cancelButton: { text: i18next.t('button.cancel') }
74
+ })
75
+ ) {
76
+ const response = await client.mutate({
77
+ mutation: gql`
78
+ mutation transferOwner($email: String!) {
79
+ transferOwner(email: $email)
80
+ }
81
+ `,
82
+ variables: { email: this.user.email },
83
+ context: gqlContext()
84
+ })
79
85
 
80
- const response = await client.mutate({
81
- mutation: gql`
82
- mutation transferOwner($email: String!) {
83
- transferOwner(email: $email)
84
- }
85
- `,
86
- variables: { email: this.user.email },
87
- context: gqlContext()
88
- })
86
+ if (!response.errors?.length) {
87
+ await OxPrompt.open({
88
+ type: 'success',
89
+ title: i18next.t('text.completed'),
90
+ text: i18next.t('text.owner_transfer_completed'),
91
+ confirmButton: { text: i18next.t('button.confirm') }
92
+ })
89
93
 
90
- if (!response.errors?.length) {
91
- await CustomAlert({
92
- type: 'success',
93
- title: i18next.t('text.completed'),
94
- text: i18next.t('text.owner_transfer_completed'),
95
- confirmButton: { text: i18next.t('button.confirm') }
96
- })
94
+ history.back()
97
95
 
96
+ this.dispatchEvent(new CustomEvent('ownershipTransferred', { bubbles: true, composed: true }))
97
+ }
98
+ } else {
98
99
  history.back()
99
-
100
- this.dispatchEvent(new CustomEvent('ownershipTransferred', { bubbles: true, composed: true }))
101
100
  }
102
101
  }
103
102
 
@@ -7,7 +7,7 @@ import { customElement, property, query } from 'lit/decorators.js'
7
7
 
8
8
  import { client, gqlContext } from '@operato/graphql'
9
9
  import { i18next, localize } from '@operato/i18n'
10
- import { CustomAlert } from '@things-factory/shell/client'
10
+ import { OxPrompt } from '@operato/popup/ox-prompt.js'
11
11
 
12
12
  import { RoleSelector } from './role-selector'
13
13
 
@@ -123,34 +123,34 @@ class PartnerRoleEditor extends localize(i18next)(LitElement) {
123
123
  }
124
124
 
125
125
  async onTerminateContract() {
126
- const answer = await CustomAlert({
127
- title: i18next.t('text.are_you_sure'),
128
- text: i18next.t('text.are_you_sure_to_terminate_contract'),
129
- confirmButton: { text: i18next.t('button.terminate contract') },
130
- cancelButton: { text: i18next.t('button.cancel') }
131
- })
132
-
133
- if (!answer.value) return
134
-
135
- const response = await client.mutate({
136
- mutation: gql`
137
- mutation terminateContract($partnerName: String!) {
138
- terminateContract(partnerName: $partnerName)
126
+ if (
127
+ await OxPrompt.open({
128
+ title: i18next.t('text.are_you_sure'),
129
+ text: i18next.t('text.are_you_sure_to_terminate_contract'),
130
+ confirmButton: { text: i18next.t('button.terminate contract') },
131
+ cancelButton: { text: i18next.t('button.cancel') }
132
+ })
133
+ ) {
134
+ const response = await client.mutate({
135
+ mutation: gql`
136
+ mutation terminateContract($partnerName: String!) {
137
+ terminateContract(partnerName: $partnerName)
138
+ }
139
+ `,
140
+ variables: { partnerName: this.customer.name },
141
+ context: gqlContext()
142
+ })
143
+
144
+ if (!response.errors?.length) {
145
+ const answer = this.dispatchEvent(new CustomEvent('contractTerminated'))
146
+
147
+ if (answer) {
148
+ await OxPrompt.open({
149
+ type: 'success',
150
+ title: i18next.t('text.completed'),
151
+ confirmButton: { text: i18next.t('button.confirm') }
152
+ })
139
153
  }
140
- `,
141
- variables: { partnerName: this.customer.name },
142
- context: gqlContext()
143
- })
144
-
145
- if (!response.errors?.length) {
146
- const answer = this.dispatchEvent(new CustomEvent('contractTerminated'))
147
-
148
- if (answer) {
149
- await CustomAlert({
150
- type: 'success',
151
- title: i18next.t('text.completed'),
152
- confirmButton: { text: i18next.t('button.confirm') }
153
- })
154
154
  }
155
155
  }
156
156
  }