@block-auth.io/angular 0.1.1 → 0.1.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.
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-lint.log +4 -4
- package/.turbo/turbo-test.log +1037 -82
- package/.turbo/turbo-typecheck.log +19 -4
- package/CHANGELOG.md +7 -0
- package/package.json +2 -2
- package/src/lib/components/txns/internals/permissions-required-modal.component.test.ts +16 -3
- package/src/lib/components/txns/internals/permissions-required-modal.component.ts +24 -16
- package/src/lib/components/txns/internals/solicited-data-modal.component.test.ts +37 -5
- package/src/lib/components/txns/internals/solicited-data-modal.component.ts +98 -65
- package/src/lib/components/txns/internals/txn-error.component.test.ts +33 -6
- package/src/lib/components/txns/internals/txn-error.component.ts +52 -29
- package/src/lib/components/txns/internals/txn.component.test.ts +63 -16
- package/src/lib/components/txns/internals/txn.component.ts +141 -61
- package/src/lib/components/txns/txns-overview.component.ts +109 -91
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
1
|
+
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
2
2
|
import { Component } from '@angular/core';
|
|
3
3
|
import { render, screen, fireEvent } from '@testing-library/angular';
|
|
4
4
|
import { map } from 'nanostores';
|
|
5
|
+
import { setLocale } from '@block-auth.io/core';
|
|
5
6
|
import { TxnComponent } from './txn.component';
|
|
6
7
|
import { provideBlockAuthClientForTest } from '../../../testing';
|
|
7
8
|
|
|
8
9
|
vi.mock('@wagmi/core', () => ({
|
|
9
10
|
createConfig: vi.fn(() => ({ connectors: [] })),
|
|
10
|
-
connect: vi.fn(),
|
|
11
|
-
|
|
11
|
+
connect: vi.fn(),
|
|
12
|
+
disconnect: vi.fn(),
|
|
13
|
+
getAccount: vi.fn(() => ({})),
|
|
14
|
+
signMessage: vi.fn(),
|
|
15
|
+
watchAccount: vi.fn(() => () => undefined),
|
|
16
|
+
http: vi.fn(),
|
|
12
17
|
}));
|
|
13
18
|
vi.mock('@wagmi/connectors', () => ({
|
|
14
|
-
injected: vi.fn(() => ({ id: 'injected' })),
|
|
19
|
+
injected: vi.fn(() => ({ id: 'injected' })),
|
|
20
|
+
walletConnect: vi.fn(() => ({ id: 'walletConnect' })),
|
|
15
21
|
}));
|
|
16
22
|
|
|
17
23
|
// Port de packages/react/src/components/txns/internals/Txn.test.tsx +
|
|
@@ -30,6 +36,8 @@ describe('Txn', () => {
|
|
|
30
36
|
} as any;
|
|
31
37
|
}
|
|
32
38
|
|
|
39
|
+
afterEach(() => setLocale('en'));
|
|
40
|
+
|
|
33
41
|
it('renderiza el cuerpo de la txn con aceptar/rechazar', async () => {
|
|
34
42
|
await render(TxnComponent, {
|
|
35
43
|
inputs: { hasSolicitedData: true },
|
|
@@ -40,10 +48,27 @@ describe('Txn', () => {
|
|
|
40
48
|
expect(screen.getByText('REJECT')).toBeDefined();
|
|
41
49
|
});
|
|
42
50
|
|
|
51
|
+
it('respeta el locale activo cuando no se pasan textos custom', async () => {
|
|
52
|
+
setLocale('es');
|
|
53
|
+
await render(TxnComponent, {
|
|
54
|
+
inputs: { hasSolicitedData: true },
|
|
55
|
+
providers: [provideBlockAuthClientForTest(makeClient())],
|
|
56
|
+
});
|
|
57
|
+
expect(screen.getByText('Permisos requeridos')).toBeDefined();
|
|
58
|
+
expect(screen.getByText('ACEPTAR')).toBeDefined();
|
|
59
|
+
expect(screen.getByText('RECHAZAR')).toBeDefined();
|
|
60
|
+
});
|
|
61
|
+
|
|
43
62
|
it('ACCEPT esta deshabilitado hasta aceptar PPTC (y allRequiredFilled)', async () => {
|
|
44
|
-
await render(TxnComponent, {
|
|
45
|
-
|
|
46
|
-
|
|
63
|
+
await render(TxnComponent, {
|
|
64
|
+
providers: [provideBlockAuthClientForTest(makeClient())],
|
|
65
|
+
});
|
|
66
|
+
const acceptBtn = screen
|
|
67
|
+
.getByText('ACCEPT')
|
|
68
|
+
.closest('button') as HTMLButtonElement;
|
|
69
|
+
const checkbox = screen.getByTestId(
|
|
70
|
+
'checkbox-animated',
|
|
71
|
+
) as HTMLInputElement;
|
|
47
72
|
expect(acceptBtn.disabled).toBe(true);
|
|
48
73
|
expect(checkbox.checked).toBe(false);
|
|
49
74
|
|
|
@@ -58,7 +83,9 @@ describe('Txn', () => {
|
|
|
58
83
|
providers: [provideBlockAuthClientForTest(makeClient())],
|
|
59
84
|
});
|
|
60
85
|
await fireEvent.click(screen.getByTestId('txn-pptc-toggle'));
|
|
61
|
-
const acceptBtn = screen
|
|
86
|
+
const acceptBtn = screen
|
|
87
|
+
.getByText('ACCEPT')
|
|
88
|
+
.closest('button') as HTMLButtonElement;
|
|
62
89
|
expect(acceptBtn.disabled).toBe(true);
|
|
63
90
|
});
|
|
64
91
|
|
|
@@ -105,7 +132,10 @@ describe('Txn', () => {
|
|
|
105
132
|
@Component({
|
|
106
133
|
standalone: true,
|
|
107
134
|
imports: [TxnComponent],
|
|
108
|
-
template: `<ba-txn
|
|
135
|
+
template: `<ba-txn
|
|
136
|
+
[selectedTxnPreParams]="{ appKey: 'k' }"
|
|
137
|
+
[addError]="e"
|
|
138
|
+
/>`,
|
|
109
139
|
})
|
|
110
140
|
class Host {
|
|
111
141
|
e = addError;
|
|
@@ -122,7 +152,10 @@ describe('Txn', () => {
|
|
|
122
152
|
@Component({
|
|
123
153
|
standalone: true,
|
|
124
154
|
imports: [TxnComponent],
|
|
125
|
-
template: `<ba-txn
|
|
155
|
+
template: `<ba-txn
|
|
156
|
+
[selectedTxnPreParams]="{ appKey: 'k', to: '0xabc' }"
|
|
157
|
+
[userParamValues]="{ 'users-email': 'a@b.com' }"
|
|
158
|
+
/>`,
|
|
126
159
|
})
|
|
127
160
|
class Host {}
|
|
128
161
|
await render(Host, { providers: [provideBlockAuthClientForTest(client)] });
|
|
@@ -141,13 +174,19 @@ describe('Txn', () => {
|
|
|
141
174
|
@Component({
|
|
142
175
|
standalone: true,
|
|
143
176
|
imports: [TxnComponent],
|
|
144
|
-
template: `<ba-txn
|
|
177
|
+
template: `<ba-txn
|
|
178
|
+
[hasSolicitedData]="true"
|
|
179
|
+
(permissionsRequiredClicked)="p()"
|
|
180
|
+
(solicitedDataClicked)="s()"
|
|
181
|
+
/>`,
|
|
145
182
|
})
|
|
146
183
|
class Host {
|
|
147
184
|
p = onPerm;
|
|
148
185
|
s = onSol;
|
|
149
186
|
}
|
|
150
|
-
await render(Host, {
|
|
187
|
+
await render(Host, {
|
|
188
|
+
providers: [provideBlockAuthClientForTest(makeClient())],
|
|
189
|
+
});
|
|
151
190
|
await fireEvent.click(screen.getByText('Permissions required'));
|
|
152
191
|
await fireEvent.click(screen.getByText('Solicited data'));
|
|
153
192
|
expect(onPerm).toHaveBeenCalledOnce();
|
|
@@ -160,9 +199,13 @@ describe('Txn', () => {
|
|
|
160
199
|
});
|
|
161
200
|
// Antes del click no hay ni slider ni TimePicker.
|
|
162
201
|
expect(container.querySelector('#txn-lifetime-slider-slider')).toBeNull();
|
|
163
|
-
await fireEvent.click(
|
|
202
|
+
await fireEvent.click(
|
|
203
|
+
screen.getByText('I want to configure my session time'),
|
|
204
|
+
);
|
|
164
205
|
// El slider estilado (SliderBase) y el input del TimePicker aparecen.
|
|
165
|
-
const slider = container.querySelector(
|
|
206
|
+
const slider = container.querySelector(
|
|
207
|
+
'#txn-lifetime-slider-slider',
|
|
208
|
+
) as HTMLInputElement;
|
|
166
209
|
expect(slider).not.toBeNull();
|
|
167
210
|
expect(slider.type).toBe('range');
|
|
168
211
|
const timeInput = container.querySelector(
|
|
@@ -177,8 +220,12 @@ describe('Txn', () => {
|
|
|
177
220
|
const { container } = await render(TxnComponent, {
|
|
178
221
|
providers: [provideBlockAuthClientForTest(makeClient())],
|
|
179
222
|
});
|
|
180
|
-
await fireEvent.click(
|
|
181
|
-
|
|
223
|
+
await fireEvent.click(
|
|
224
|
+
screen.getByText('I want to configure my session time'),
|
|
225
|
+
);
|
|
226
|
+
const slider = container.querySelector(
|
|
227
|
+
'#txn-lifetime-slider-slider',
|
|
228
|
+
) as HTMLInputElement;
|
|
182
229
|
await fireEvent.input(slider, { target: { value: '7200' } }); // 02:00:00
|
|
183
230
|
const timeInput = container.querySelector(
|
|
184
231
|
'#txn-lifetime-slider-time-picker-time-input',
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
output,
|
|
9
9
|
signal,
|
|
10
10
|
} from '@angular/core';
|
|
11
|
+
import { $locale, t as translate, type TextKey } from '@block-auth.io/core';
|
|
12
|
+
import { injectStore } from '../../../inject-store';
|
|
11
13
|
import { injectBlockAuthClient } from '../../../provide-block-auth';
|
|
12
14
|
import { ArrowIconComponent } from '../../../primitives/arrow-icon.component';
|
|
13
15
|
import { LifetimeSliderBaseComponent } from '../../../primitives/lifetime-slider-base.component';
|
|
@@ -42,16 +44,22 @@ interface TxnPreParams {
|
|
|
42
44
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
43
45
|
imports: [ArrowIconComponent, LifetimeSliderBaseComponent],
|
|
44
46
|
template: `
|
|
45
|
-
<div
|
|
46
|
-
|
|
47
|
+
<div
|
|
48
|
+
class="bas-flex bas-h-full bas-w-full bas-flex-col bas-items-center bas-justify-between"
|
|
49
|
+
>
|
|
50
|
+
<div
|
|
51
|
+
class="bal-ba-transition-3 bas-flex bas-w-full bas-flex-col bas-gap-8 bas-pt-2"
|
|
52
|
+
>
|
|
47
53
|
<div
|
|
48
54
|
class="bal-ba-outline-none bas-grid bas-h-[30px] bas-cursor-pointer bas-grid-cols-[65px_auto_65px] bas-items-center bas-justify-center bas-gap-2"
|
|
49
55
|
(click)="permissionsRequiredClicked.emit()"
|
|
50
56
|
>
|
|
51
57
|
<ba-arrow-icon direction="right" />
|
|
52
58
|
<div class="bas-flex bas-h-full bas-w-full bas-items-end">
|
|
53
|
-
<p
|
|
54
|
-
|
|
59
|
+
<p
|
|
60
|
+
class="bas-m-0 bas-text-center bas-text-lg bas-font-medium bas-text-[var(--bal-primary-900)]"
|
|
61
|
+
>
|
|
62
|
+
{{ permissionsRequiredTxtResolved() }}
|
|
55
63
|
</p>
|
|
56
64
|
</div>
|
|
57
65
|
<ba-arrow-icon direction="left" />
|
|
@@ -60,12 +68,16 @@ interface TxnPreParams {
|
|
|
60
68
|
<div
|
|
61
69
|
[class]="
|
|
62
70
|
'bas-grid bas-h-[30px] bas-grid-cols-[65px_auto_65px] bas-items-center bas-justify-center bas-gap-2 ' +
|
|
63
|
-
(hasSolicitedData()
|
|
71
|
+
(hasSolicitedData()
|
|
72
|
+
? 'bas-cursor-pointer'
|
|
73
|
+
: 'bas-cursor-not-allowed bas-opacity-40')
|
|
64
74
|
"
|
|
65
75
|
(click)="onSolicitedDataClick()"
|
|
66
76
|
>
|
|
67
77
|
<ba-arrow-icon direction="right" />
|
|
68
|
-
<div
|
|
78
|
+
<div
|
|
79
|
+
class="bas-flex bas-h-full bas-w-full bas-items-end bas-justify-center"
|
|
80
|
+
>
|
|
69
81
|
<p
|
|
70
82
|
[class]="
|
|
71
83
|
'bas-m-0 bas-text-center bas-text-lg bas-transition-colors ' +
|
|
@@ -74,7 +86,7 @@ interface TxnPreParams {
|
|
|
74
86
|
: 'bas-text-slate-400')
|
|
75
87
|
"
|
|
76
88
|
>
|
|
77
|
-
{{
|
|
89
|
+
{{ solicitedDataTxtResolved() }}
|
|
78
90
|
</p>
|
|
79
91
|
</div>
|
|
80
92
|
<ba-arrow-icon direction="left" />
|
|
@@ -82,40 +94,55 @@ interface TxnPreParams {
|
|
|
82
94
|
</div>
|
|
83
95
|
|
|
84
96
|
@if (!showLifetime()) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
id="btn-configure-session-time"
|
|
100
|
+
class="bal-ba-transition-2 bas-flex bas-w-full bas-cursor-pointer bas-flex-row bas-items-end bas-justify-center bas-gap-2 bas-border-0 bas-bg-transparent bas-text-[--bal-primary-700] hover:bas-text-[--bal-primary-900]"
|
|
101
|
+
(click)="showLifetime.set(true)"
|
|
102
|
+
>
|
|
103
|
+
<p class="bas-m-0 bas-text-center bas-text-base">
|
|
104
|
+
{{ configureSessionTimeTxtResolved() }}
|
|
105
|
+
</p>
|
|
106
|
+
<svg
|
|
107
|
+
class="bas-h-5 bas-w-5"
|
|
108
|
+
viewBox="0 0 24 24"
|
|
109
|
+
fill="none"
|
|
110
|
+
stroke="currentColor"
|
|
111
|
+
stroke-width="1.8"
|
|
112
|
+
aria-hidden="true"
|
|
90
113
|
>
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
114
|
+
<circle cx="12" cy="12" r="9" />
|
|
115
|
+
<path
|
|
116
|
+
d="M12 7v5l3 2"
|
|
117
|
+
stroke-linecap="round"
|
|
118
|
+
stroke-linejoin="round"
|
|
119
|
+
/>
|
|
120
|
+
</svg>
|
|
121
|
+
</button>
|
|
97
122
|
} @else {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
123
|
+
<ba-lifetime-slider-base
|
|
124
|
+
id="txn-lifetime-slider"
|
|
125
|
+
[sliderValue]="lifetimeSign()"
|
|
126
|
+
[step]="1"
|
|
127
|
+
[min]="minLifetime()"
|
|
128
|
+
[max]="maxLifetime()"
|
|
129
|
+
[timeInputValue]="lifetimeTimeValue()"
|
|
130
|
+
[isOpen]="isTimePickerOpen()"
|
|
131
|
+
[isTimePickerInsideModal]="true"
|
|
132
|
+
modalId="txns-overview"
|
|
133
|
+
timePickerDropdownDirection="up"
|
|
134
|
+
classNames="bas-grid bas-h-auto bas-w-full bas-items-center bas-gap-3 bas-grid-cols-[152px_1fr]"
|
|
135
|
+
timePickerContainerClassNames="bas-flex bas-w-full bas-items-center bas-justify-center"
|
|
136
|
+
(sliderValueChanged)="onLifetimeValueChanged($event)"
|
|
137
|
+
(timeChanged)="onLifetimeValueChanged($event)"
|
|
138
|
+
(isOpenChange)="isTimePickerOpen.set($event)"
|
|
139
|
+
(toggleTimerDropdown)="toggleTimerDropdown()"
|
|
140
|
+
/>
|
|
116
141
|
}
|
|
117
142
|
|
|
118
|
-
<div
|
|
143
|
+
<div
|
|
144
|
+
class="bal-ba-transition-3 bas-flex bas-w-full bas-flex-col bas-gap-8 bas-pb-4"
|
|
145
|
+
>
|
|
119
146
|
<div
|
|
120
147
|
data-testid="txn-pptc-toggle"
|
|
121
148
|
[class]="
|
|
@@ -139,21 +166,29 @@ interface TxnPreParams {
|
|
|
139
166
|
class="bal-ba-checkbox-animated-input bal-ba-outline-none bas-peer bas-hidden"
|
|
140
167
|
(change)="pptcAccepted.set(!pptcAccepted())"
|
|
141
168
|
/>
|
|
142
|
-
<span
|
|
169
|
+
<span
|
|
170
|
+
class="bal-ba-input-check bal-ba-input-check-big bal-ba-transition-3 bas-relative bas-top-0 bas-inline-block bas-h-[25px] bas-w-[25px] bas-cursor-pointer bas-rounded-[4px] bas-border-2 bas-border-solid bas-border-[#c2c6c8] group-hover:bas-border-[#61a5c2] peer-checked:bas-border-2 peer-checked:bas-border-solid peer-checked:bas-border-[var(--bal-primary-600)] peer-checked:bas-bg-[var(--bal-primary-600)] peer-disabled:bas-cursor-not-allowed peer-disabled:bas-opacity-50"
|
|
171
|
+
></span>
|
|
143
172
|
</label>
|
|
144
173
|
</div>
|
|
145
|
-
<div
|
|
174
|
+
<div
|
|
175
|
+
class="bas-flex bas-flex-col bas-gap-0.5 bas-text-sm bas-text-[var(--bal-primary-500)] group-hover:bas-text-[var(--bal-primary-800)]"
|
|
176
|
+
>
|
|
146
177
|
<div class="bas-flex bas-flex-row bas-items-center bas-gap-1">
|
|
147
|
-
<p class="bal-ba-transition-2 bas-m-0 bas-cursor-default">
|
|
178
|
+
<p class="bal-ba-transition-2 bas-m-0 bas-cursor-default">
|
|
179
|
+
{{ iAuthorizeTheTxtResolved() }}
|
|
180
|
+
</p>
|
|
148
181
|
<button
|
|
149
182
|
type="button"
|
|
150
183
|
data-testid="btn-privacy-policy"
|
|
151
184
|
class="bal-ba-transition-2 bas-flex bas-h-full bas-cursor-pointer bas-items-center bas-border-none bas-bg-transparent bas-p-0 bas-pb-[1px] bas-text-sm bas-text-[var(--bal-primary-700)] bas-underline group-hover:bas-text-[var(--bal-primary-900)]"
|
|
152
185
|
(click)="openPrivacyPolicy()"
|
|
153
186
|
>
|
|
154
|
-
{{
|
|
187
|
+
{{ privacyPolicyTxtResolved() }}
|
|
155
188
|
</button>
|
|
156
|
-
<p class="bal-ba-transition-2 bas-m-0 bas-cursor-default">
|
|
189
|
+
<p class="bal-ba-transition-2 bas-m-0 bas-cursor-default">
|
|
190
|
+
{{ andTheTxtResolved() }}
|
|
191
|
+
</p>
|
|
157
192
|
</div>
|
|
158
193
|
<button
|
|
159
194
|
type="button"
|
|
@@ -161,19 +196,23 @@ interface TxnPreParams {
|
|
|
161
196
|
class="bal-ba-transition-2 bas-flex bas-h-full bas-w-fit bas-cursor-pointer bas-items-center bas-border-none bas-bg-transparent bas-p-0 bas-pb-[1px] bas-text-sm bas-text-[var(--bal-primary-700)] bas-underline group-hover:bas-text-[var(--bal-primary-900)]"
|
|
162
197
|
(click)="openTermsAndConditions()"
|
|
163
198
|
>
|
|
164
|
-
{{
|
|
199
|
+
{{ termsAndConditionsTxtResolved() }}
|
|
165
200
|
</button>
|
|
166
201
|
</div>
|
|
167
202
|
</div>
|
|
168
|
-
<div
|
|
203
|
+
<div
|
|
204
|
+
class="bas-flex bas-w-full bas-flex-row bas-items-center bas-justify-between bas-gap-2"
|
|
205
|
+
>
|
|
169
206
|
<button
|
|
170
207
|
type="button"
|
|
171
208
|
id="btn-txn-reject"
|
|
172
209
|
class="bal-ba-ring-base bal-ba-ring bal-ba-transition-2 bas-group bas-relative bas-box-border bas-flex bas-flex-row bas-gap-2 bas-items-center bas-overflow-hidden bas-bg-transparent bal-ba-hover-ring-slate-400 bal-ba-focus-ring-slate-400 bas-h-[42px] bas-px-2.5 bas-py-0 disabled:bas-cursor-not-allowed disabled:bas-opacity-50 bal-ba-hover-ring-2 bas-cursor-pointer bal-ba-focus-ring-2 focus:bas-opacity-90 bal-ba-focus-ring-offset-0 bas-w-full bas-justify-center bas-border-2 bas-border-slate-400 bas-rounded-md bas-border-solid"
|
|
173
210
|
(click)="onTxnRejectClicked()"
|
|
174
211
|
>
|
|
175
|
-
<span
|
|
176
|
-
|
|
212
|
+
<span
|
|
213
|
+
class="bal-ba-transition-2 bas-text-center bas-text-base bas-font-medium bas-text-slate-600 group-hover:bas-text-slate-800 bas-flex bas-h-full bas-items-center"
|
|
214
|
+
>
|
|
215
|
+
{{ rejectTxtResolved() }}
|
|
177
216
|
</span>
|
|
178
217
|
</button>
|
|
179
218
|
<button
|
|
@@ -183,8 +222,10 @@ interface TxnPreParams {
|
|
|
183
222
|
class="bal-ba-ring-base bal-ba-ring bal-ba-transition-2 bas-group bas-relative bas-box-border bas-flex bas-flex-row bas-gap-2 bas-items-center bas-overflow-hidden bas-bg-[#38b000] hover:bas-bg-[#329e00] bal-ba-hover-ring-green-500 bal-ba-focus-ring-green-500 bas-h-[42px] bas-px-2.5 bas-py-0 disabled:bas-cursor-not-allowed disabled:bas-opacity-50 bal-ba-hover-ring-2 bas-cursor-pointer bal-ba-focus-ring-2 focus:bas-opacity-90 bal-ba-focus-ring-offset-2 bal-ba-hover-ring-offset-2 bas-w-full bas-justify-center bas-border-none bas-rounded-md"
|
|
184
223
|
(click)="onTxnAcceptClicked()"
|
|
185
224
|
>
|
|
186
|
-
<span
|
|
187
|
-
|
|
225
|
+
<span
|
|
226
|
+
class="bal-ba-transition-2 bas-text-white bas-text-center bas-text-base bas-font-medium bas-flex bas-h-full bas-items-center"
|
|
227
|
+
>
|
|
228
|
+
{{ acceptTxtResolved() }}
|
|
188
229
|
</span>
|
|
189
230
|
</button>
|
|
190
231
|
</div>
|
|
@@ -193,15 +234,15 @@ interface TxnPreParams {
|
|
|
193
234
|
`,
|
|
194
235
|
})
|
|
195
236
|
export class TxnComponent {
|
|
196
|
-
permissionsRequiredTxt = input(
|
|
197
|
-
solicitedDataTxt = input(
|
|
198
|
-
rejectTxt = input(
|
|
199
|
-
acceptTxt = input(
|
|
200
|
-
iAuthorizeTheTxt = input(
|
|
201
|
-
privacyPolicyTxt = input(
|
|
202
|
-
andTheTxt = input(
|
|
203
|
-
termsAndConditionsTxt = input(
|
|
204
|
-
configureSessionTimeTxt = input(
|
|
237
|
+
permissionsRequiredTxt = input<string>();
|
|
238
|
+
solicitedDataTxt = input<string>();
|
|
239
|
+
rejectTxt = input<string>();
|
|
240
|
+
acceptTxt = input<string>();
|
|
241
|
+
iAuthorizeTheTxt = input<string>();
|
|
242
|
+
privacyPolicyTxt = input<string>();
|
|
243
|
+
andTheTxt = input<string>();
|
|
244
|
+
termsAndConditionsTxt = input<string>();
|
|
245
|
+
configureSessionTimeTxt = input<string>();
|
|
205
246
|
hasSolicitedData = input(false);
|
|
206
247
|
allRequiredFilled = input(true);
|
|
207
248
|
closeTxns = input<() => void>(() => {});
|
|
@@ -218,13 +259,49 @@ export class TxnComponent {
|
|
|
218
259
|
solicitedDataClicked = output<void>();
|
|
219
260
|
|
|
220
261
|
private readonly client = injectBlockAuthClient();
|
|
262
|
+
private readonly locale = injectStore($locale);
|
|
263
|
+
protected t = (key: TextKey): string => translate(key, this.locale());
|
|
264
|
+
|
|
265
|
+
protected readonly permissionsRequiredTxtResolved = computed(
|
|
266
|
+
() => this.permissionsRequiredTxt() ?? this.t('permissionsRequired'),
|
|
267
|
+
);
|
|
268
|
+
protected readonly solicitedDataTxtResolved = computed(
|
|
269
|
+
() => this.solicitedDataTxt() ?? this.t('solicitedData'),
|
|
270
|
+
);
|
|
271
|
+
protected readonly rejectTxtResolved = computed(
|
|
272
|
+
() => this.rejectTxt() ?? this.t('reject'),
|
|
273
|
+
);
|
|
274
|
+
protected readonly acceptTxtResolved = computed(
|
|
275
|
+
() => this.acceptTxt() ?? this.t('accept'),
|
|
276
|
+
);
|
|
277
|
+
protected readonly iAuthorizeTheTxtResolved = computed(
|
|
278
|
+
() => this.iAuthorizeTheTxt() ?? this.t('iAuthorizeThe'),
|
|
279
|
+
);
|
|
280
|
+
protected readonly privacyPolicyTxtResolved = computed(
|
|
281
|
+
() => this.privacyPolicyTxt() ?? this.t('privacyPolicy'),
|
|
282
|
+
);
|
|
283
|
+
protected readonly andTheTxtResolved = computed(
|
|
284
|
+
() => this.andTheTxt() ?? this.t('andThe'),
|
|
285
|
+
);
|
|
286
|
+
protected readonly termsAndConditionsTxtResolved = computed(
|
|
287
|
+
() => this.termsAndConditionsTxt() ?? this.t('termsAndConditions'),
|
|
288
|
+
);
|
|
289
|
+
protected readonly configureSessionTimeTxtResolved = computed(
|
|
290
|
+
() => this.configureSessionTimeTxt() ?? this.t('configureSessionTime'),
|
|
291
|
+
);
|
|
221
292
|
|
|
222
293
|
protected readonly pptcAccepted = signal(false);
|
|
223
294
|
protected readonly showLifetime = signal(false);
|
|
224
295
|
|
|
225
|
-
private readonly lifetimeData = computed(
|
|
226
|
-
|
|
227
|
-
|
|
296
|
+
private readonly lifetimeData = computed(
|
|
297
|
+
() => this.selectedTxnPreParams().lifetime ?? {},
|
|
298
|
+
);
|
|
299
|
+
protected readonly minLifetime = computed(
|
|
300
|
+
() => this.lifetimeData().min ?? 10,
|
|
301
|
+
);
|
|
302
|
+
protected readonly maxLifetime = computed(
|
|
303
|
+
() => this.lifetimeData().max ?? 29100,
|
|
304
|
+
);
|
|
228
305
|
protected readonly lifetimeSign = signal(this.lifetime());
|
|
229
306
|
// El TimePicker refleja `lifetimeSign` como string HH:MM:SS; tanto el slider
|
|
230
307
|
// como el picker reportan en segundos, así un único handler mantiene ambos
|
|
@@ -288,7 +365,10 @@ export class TxnComponent {
|
|
|
288
365
|
if (!preParams.appKey) return this.addError()('no_app_key_found');
|
|
289
366
|
if (!preParams.to) return this.addError()('no_contract_address_found');
|
|
290
367
|
this.client.state.$ui.setKey('isAcceptingTxn', true);
|
|
291
|
-
this.client.txns.accept({
|
|
368
|
+
this.client.txns.accept({
|
|
369
|
+
lifetime: this.lifetimeSign(),
|
|
370
|
+
userParams: this.userParamValues(),
|
|
371
|
+
});
|
|
292
372
|
// Auto-close after 4s if txns are cleared (matches original behaviour).
|
|
293
373
|
this.autoCloseTimeout = setTimeout(() => {
|
|
294
374
|
const requests = this.client.state.$ws.get().requests;
|