@block-auth.io/angular 0.3.2 → 0.4.1
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/fesm2022/block-auth.io-angular.mjs +9828 -0
- package/fesm2022/block-auth.io-angular.mjs.map +1 -0
- package/index.d.ts +1144 -0
- package/package.json +16 -37
- package/.turbo/turbo-build.log +0 -37
- package/.turbo/turbo-lint.log +0 -4
- package/.turbo/turbo-test.log +0 -2001
- package/.turbo/turbo-typecheck.log +0 -19
- package/CHANGELOG.md +0 -245
- package/ng-package.json +0 -6
- package/scripts/css-to-ts.mjs +0 -14
- package/src/lib/__tests__/integration.test.ts +0 -45
- package/src/lib/block-auth.service.test.ts +0 -69
- package/src/lib/block-auth.service.ts +0 -81
- package/src/lib/components/btns/btn-base-provider.component.test.ts +0 -22
- package/src/lib/components/btns/btn-base-provider.component.ts +0 -55
- package/src/lib/components/btns/btn-block-auth.component.test.ts +0 -105
- package/src/lib/components/btns/btn-block-auth.component.ts +0 -117
- package/src/lib/components/btns/btn-gmail.component.test.ts +0 -16
- package/src/lib/components/btns/btn-gmail.component.ts +0 -41
- package/src/lib/components/btns/btn-google-base.component.test.ts +0 -16
- package/src/lib/components/btns/btn-google-base.component.ts +0 -73
- package/src/lib/components/btns/btn-metamask.component.test.ts +0 -20
- package/src/lib/components/btns/btn-metamask.component.ts +0 -98
- package/src/lib/components/btns/btn-microsoft.component.test.ts +0 -16
- package/src/lib/components/btns/btn-microsoft.component.ts +0 -77
- package/src/lib/components/btns/btn-phantom.component.test.ts +0 -20
- package/src/lib/components/btns/btn-phantom.component.ts +0 -93
- package/src/lib/components/btns/btn-signin.component.test.ts +0 -55
- package/src/lib/components/btns/btn-signin.component.ts +0 -108
- package/src/lib/components/btns/btn-wallet-connect.component.test.ts +0 -20
- package/src/lib/components/btns/btn-wallet-connect.component.ts +0 -109
- package/src/lib/components/btns/index.ts +0 -11
- package/src/lib/components/contents/content-signin.component.test.ts +0 -33
- package/src/lib/components/contents/content-signin.component.ts +0 -68
- package/src/lib/components/contents/content-signup.component.test.ts +0 -86
- package/src/lib/components/contents/content-signup.component.ts +0 -234
- package/src/lib/components/dds/change-account.component.test.ts +0 -66
- package/src/lib/components/dds/change-account.component.ts +0 -112
- package/src/lib/components/dds/dropdown-profile-btn.component.test.ts +0 -66
- package/src/lib/components/dds/dropdown-profile-btn.component.ts +0 -170
- package/src/lib/components/dds/dropdown-profile-item.component.test.ts +0 -75
- package/src/lib/components/dds/dropdown-profile-item.component.ts +0 -74
- package/src/lib/components/dds/dropdown-profile.component.test.ts +0 -110
- package/src/lib/components/dds/dropdown-profile.component.ts +0 -264
- package/src/lib/components/flow-block-auth.component.test.ts +0 -93
- package/src/lib/components/flow-block-auth.component.ts +0 -226
- package/src/lib/components/modals/modal-overlay.component.test.ts +0 -81
- package/src/lib/components/modals/modal-overlay.component.ts +0 -43
- package/src/lib/components/modals/modal-restoration-expired.component.test.ts +0 -71
- package/src/lib/components/modals/modal-restoration-expired.component.ts +0 -83
- package/src/lib/components/modals/modal-restore.component.test.ts +0 -74
- package/src/lib/components/modals/modal-restore.component.ts +0 -104
- package/src/lib/components/modals/modal-signin.component.test.ts +0 -66
- package/src/lib/components/modals/modal-signin.component.ts +0 -44
- package/src/lib/components/modals/modal-signup.component.test.ts +0 -56
- package/src/lib/components/modals/modal-signup.component.ts +0 -40
- package/src/lib/components/sections/footer-section.component.test.ts +0 -19
- package/src/lib/components/sections/footer-section.component.ts +0 -49
- package/src/lib/components/sections/internals/providers-buttons.component.test.ts +0 -27
- package/src/lib/components/sections/internals/providers-buttons.component.ts +0 -290
- package/src/lib/components/sections/internals/providers-filters.component.test.ts +0 -25
- package/src/lib/components/sections/internals/providers-filters.component.ts +0 -139
- package/src/lib/components/sections/internals/selected-button.component.test.ts +0 -36
- package/src/lib/components/sections/internals/selected-button.component.ts +0 -92
- package/src/lib/components/sections/login-section.component.test.ts +0 -49
- package/src/lib/components/sections/login-section.component.ts +0 -120
- package/src/lib/components/sections/providers-section.component.test.ts +0 -22
- package/src/lib/components/sections/providers-section.component.ts +0 -187
- package/src/lib/components/txns/internals/permissions-required-modal.component.test.ts +0 -36
- package/src/lib/components/txns/internals/permissions-required-modal.component.ts +0 -43
- package/src/lib/components/txns/internals/phone-input.component.test.ts +0 -119
- package/src/lib/components/txns/internals/phone-input.component.ts +0 -301
- package/src/lib/components/txns/internals/solicited-data-modal.component.test.ts +0 -661
- package/src/lib/components/txns/internals/solicited-data-modal.component.ts +0 -415
- package/src/lib/components/txns/internals/txn-error.component.test.ts +0 -127
- package/src/lib/components/txns/internals/txn-error.component.ts +0 -144
- package/src/lib/components/txns/internals/txn-type.component.test.ts +0 -52
- package/src/lib/components/txns/internals/txn-type.component.ts +0 -51
- package/src/lib/components/txns/internals/txn.component.test.ts +0 -580
- package/src/lib/components/txns/internals/txn.component.ts +0 -461
- package/src/lib/components/txns/txns-overview.component.test.ts +0 -421
- package/src/lib/components/txns/txns-overview.component.ts +0 -424
- package/src/lib/icons/ai-outline-disconnect.component.ts +0 -21
- package/src/lib/icons/bi-logo-gmail.component.ts +0 -21
- package/src/lib/icons/cg-profile.component.ts +0 -31
- package/src/lib/icons/check-icon.component.ts +0 -27
- package/src/lib/icons/ci-clock2.component.ts +0 -31
- package/src/lib/icons/fa-arrow-right.component.ts +0 -21
- package/src/lib/icons/fa-times.component.ts +0 -21
- package/src/lib/icons/fa-undo.component.ts +0 -21
- package/src/lib/icons/icons.test.ts +0 -25
- package/src/lib/icons/index.ts +0 -22
- package/src/lib/icons/io-ios-arrow-back.component.ts +0 -21
- package/src/lib/icons/io-ios-arrow-forward.component.ts +0 -21
- package/src/lib/icons/io-md-arrow-back.component.ts +0 -19
- package/src/lib/icons/io-md-arrow-forward.component.ts +0 -19
- package/src/lib/icons/pi-warning-fill.component.ts +0 -21
- package/src/lib/icons/tb-arrows-exchange2.component.ts +0 -30
- package/src/lib/icons/tb-copy-check-filled.component.ts +0 -21
- package/src/lib/icons/tb-copy.component.ts +0 -34
- package/src/lib/icons/ti-vendor-microsoft.component.ts +0 -21
- package/src/lib/inject-store.test.ts +0 -26
- package/src/lib/inject-store.ts +0 -16
- package/src/lib/primitives/arrow-icon.component.test.ts +0 -25
- package/src/lib/primitives/arrow-icon.component.ts +0 -45
- package/src/lib/primitives/btn-arrow-dir.component.test.ts +0 -22
- package/src/lib/primitives/btn-arrow-dir.component.ts +0 -65
- package/src/lib/primitives/btn-base.component.test.ts +0 -38
- package/src/lib/primitives/btn-base.component.ts +0 -140
- package/src/lib/primitives/divider-base.component.test.ts +0 -12
- package/src/lib/primitives/divider-base.component.ts +0 -74
- package/src/lib/primitives/dropdown-arrow.component.test.ts +0 -12
- package/src/lib/primitives/dropdown-arrow.component.ts +0 -46
- package/src/lib/primitives/dropdown-base.component.test.ts +0 -49
- package/src/lib/primitives/dropdown-base.component.ts +0 -329
- package/src/lib/primitives/helpers.ts +0 -151
- package/src/lib/primitives/horizontal-loader.component.test.ts +0 -19
- package/src/lib/primitives/horizontal-loader.component.ts +0 -70
- package/src/lib/primitives/icon-base.component.test.ts +0 -19
- package/src/lib/primitives/icon-base.component.ts +0 -58
- package/src/lib/primitives/img-loader.component.test.ts +0 -12
- package/src/lib/primitives/img-loader.component.ts +0 -118
- package/src/lib/primitives/index.ts +0 -29
- package/src/lib/primitives/input-base.component.test.ts +0 -20
- package/src/lib/primitives/input-base.component.ts +0 -210
- package/src/lib/primitives/lifetime-slider-base.component.test.ts +0 -88
- package/src/lib/primitives/lifetime-slider-base.component.ts +0 -75
- package/src/lib/primitives/oval-spinner.component.test.ts +0 -9
- package/src/lib/primitives/oval-spinner.component.ts +0 -158
- package/src/lib/primitives/pickers/dropdown-picker-animated-base.component.ts +0 -220
- package/src/lib/primitives/pickers/picker-button.component.ts +0 -74
- package/src/lib/primitives/pickers/time-picker-dropdown-selector.component.ts +0 -188
- package/src/lib/primitives/pickers/time-picker.component.ts +0 -124
- package/src/lib/primitives/pickers/time-unit-selector.component.ts +0 -82
- package/src/lib/primitives/progressbar.component.test.ts +0 -18
- package/src/lib/primitives/progressbar.component.ts +0 -93
- package/src/lib/primitives/providersStyles.ts +0 -268
- package/src/lib/primitives/slider-base.component.ts +0 -56
- package/src/lib/provide-block-auth.test.ts +0 -43
- package/src/lib/provide-block-auth.ts +0 -43
- package/src/lib/runtime/block-auth-runtime.directive.test.ts +0 -89
- package/src/lib/runtime/block-auth-runtime.directive.ts +0 -68
- package/src/lib/teleport-body.directive.test.ts +0 -29
- package/src/lib/teleport-body.directive.ts +0 -21
- package/src/lib/testing.ts +0 -15
- package/src/lib/transitions.css +0 -23
- package/src/public-api.ts +0 -86
- package/src/vitest.setup.ts +0 -8
- package/tailwind.config.cjs +0 -6
- package/tsconfig.json +0 -15
- package/tsconfig.lib.json +0 -9
- package/vite.config.mts +0 -44
|
@@ -1,461 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
DestroyRef,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
output,
|
|
9
|
-
signal,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { $locale, t as translate, type TextKey } from '@block-auth.io/core';
|
|
12
|
-
import { injectStore } from '../../../inject-store';
|
|
13
|
-
import { injectBlockAuthClient } from '../../../provide-block-auth';
|
|
14
|
-
import { ArrowIconComponent } from '../../../primitives/arrow-icon.component';
|
|
15
|
-
import { LifetimeSliderBaseComponent } from '../../../primitives/lifetime-slider-base.component';
|
|
16
|
-
import { getTimeBySec } from '../../../primitives/helpers';
|
|
17
|
-
|
|
18
|
-
// Con `showLifetime` se revela el `<ba-lifetime-slider-base>` completo (slider +
|
|
19
|
-
// TimePicker HH:MM:SS con dropdown animado), igual que react/vue. El slider y el
|
|
20
|
-
// picker reportan en segundos; `onLifetimeValueChanged` mantiene ambas vistas
|
|
21
|
-
// (`lifetimeSign` número + `lifetimeTimeValue` HH:MM:SS) en sync. El valor
|
|
22
|
-
// elegido (segundos) es lo que ACCEPT envía como `lifetime`. El botón que revela
|
|
23
|
-
// el control (`id="btn-configure-session-time"`) se mantiene idéntico.
|
|
24
|
-
//
|
|
25
|
-
// `onPermissionsRequiredClicked`/`onSolicitedDataClicked` (callback props) ->
|
|
26
|
-
// outputs `permissionsRequiredClicked`/`solicitedDataClicked`. `closeTxns`/
|
|
27
|
-
// `addError` se mantienen como INPUTS DE FUNCIÓN (invocados imperativamente).
|
|
28
|
-
//
|
|
29
|
-
// `close()` NO llama a `closeTxns`: reject ya emite `cancelled` por sí mismo y
|
|
30
|
-
// accept no debe deshacerse (encadenar `closeTxns()` cancelaría dos veces en
|
|
31
|
-
// reject y cancelaría una txn ya aceptada). El `setTimeout` de autocierre de 4s
|
|
32
|
-
// se limpia vía `DestroyRef`. `data-testid="txn-pptc-toggle"` en el div exterior
|
|
33
|
-
// del check PPTC (solo testability, igual que el port Vue).
|
|
34
|
-
interface TxnPreParams {
|
|
35
|
-
appKey?: string;
|
|
36
|
-
to?: string;
|
|
37
|
-
lifetime?: { value?: number; min?: number; max?: number };
|
|
38
|
-
[key: string]: unknown;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@Component({
|
|
42
|
-
selector: 'ba-txn',
|
|
43
|
-
standalone: true,
|
|
44
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
45
|
-
imports: [ArrowIconComponent, LifetimeSliderBaseComponent],
|
|
46
|
-
template: `
|
|
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-glass-rise bas-flex bas-w-full bas-flex-col bas-gap-8 bas-pt-2"
|
|
52
|
-
>
|
|
53
|
-
<div class="bas-relative bas-flex bas-w-full">
|
|
54
|
-
<button
|
|
55
|
-
type="button"
|
|
56
|
-
id="btn-txn-permissions-required"
|
|
57
|
-
class="bal-ba-glass-btn"
|
|
58
|
-
(click)="permissionsRequiredClicked.emit()"
|
|
59
|
-
>
|
|
60
|
-
<span class="bal-ba-glass-btn-label">
|
|
61
|
-
{{ permissionsRequiredTxtResolved() }}
|
|
62
|
-
</span>
|
|
63
|
-
</button>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
<div class="bas-relative bas-flex bas-w-full">
|
|
67
|
-
<button
|
|
68
|
-
type="button"
|
|
69
|
-
id="btn-txn-solicited-data"
|
|
70
|
-
[disabled]="!hasSolicitedData()"
|
|
71
|
-
[class]="
|
|
72
|
-
'bal-ba-glass-btn' +
|
|
73
|
-
(showSolicitedArrows() ? ' bal-ba-glass-btn-pending' : '') +
|
|
74
|
-
(acceptHint() === 'solicitedData' ? ' bal-ba-head-shake' : '')
|
|
75
|
-
"
|
|
76
|
-
(click)="onSolicitedDataClick()"
|
|
77
|
-
>
|
|
78
|
-
<span class="bal-ba-glass-btn-label">
|
|
79
|
-
{{ solicitedDataTxtResolved() }}
|
|
80
|
-
</span>
|
|
81
|
-
</button>
|
|
82
|
-
<span class="bal-ba-glass-btn-arrow bal-ba-glass-btn-arrow-left">
|
|
83
|
-
<ba-arrow-icon
|
|
84
|
-
direction="right"
|
|
85
|
-
[visible]="showSolicitedArrows()"
|
|
86
|
-
/>
|
|
87
|
-
</span>
|
|
88
|
-
<span class="bal-ba-glass-btn-arrow bal-ba-glass-btn-arrow-right">
|
|
89
|
-
<ba-arrow-icon direction="left" [visible]="showSolicitedArrows()" />
|
|
90
|
-
</span>
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
|
|
94
|
-
<button
|
|
95
|
-
type="button"
|
|
96
|
-
id="btn-configure-session-time"
|
|
97
|
-
class="bal-ba-glass-link bal-ba-glass-rise 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]"
|
|
98
|
-
(click)="showLifetime.set(true)"
|
|
99
|
-
>
|
|
100
|
-
<p class="bas-m-0 bas-text-center bas-text-base">
|
|
101
|
-
{{ configureSessionTimeTxtResolved() }}
|
|
102
|
-
@if (isLifetimeConfigured()) {
|
|
103
|
-
<span id="txn-lifetime-value" class="bal-ba-glass-link-value">{{
|
|
104
|
-
lifetimeTimeValue()
|
|
105
|
-
}}</span>
|
|
106
|
-
}
|
|
107
|
-
</p>
|
|
108
|
-
<svg
|
|
109
|
-
class="bas-h-5 bas-w-5"
|
|
110
|
-
viewBox="0 0 24 24"
|
|
111
|
-
fill="none"
|
|
112
|
-
stroke="currentColor"
|
|
113
|
-
stroke-width="1.8"
|
|
114
|
-
aria-hidden="true"
|
|
115
|
-
>
|
|
116
|
-
<circle cx="12" cy="12" r="9" />
|
|
117
|
-
<path
|
|
118
|
-
d="M12 7v5l3 2"
|
|
119
|
-
stroke-linecap="round"
|
|
120
|
-
stroke-linejoin="round"
|
|
121
|
-
/>
|
|
122
|
-
</svg>
|
|
123
|
-
</button>
|
|
124
|
-
|
|
125
|
-
@if (showLifetime()) {
|
|
126
|
-
<div
|
|
127
|
-
class="bal-ba-glass-backdrop bal-ba-backdrop-blur-base bal-ba-backdrop-blur-sm bas-absolute bas-inset-0 bas-z-30 bas-box-border bas-h-full bas-w-full"
|
|
128
|
-
(click)="closeLifetime()"
|
|
129
|
-
></div>
|
|
130
|
-
<div
|
|
131
|
-
class="bal-ba-glass-popup-slot bas-absolute bas-inset-x-0 bas-top-44 bas-z-40"
|
|
132
|
-
>
|
|
133
|
-
<div
|
|
134
|
-
role="dialog"
|
|
135
|
-
id="txn-lifetime-modal"
|
|
136
|
-
[attr.aria-label]="configureSessionTimeTxtResolved()"
|
|
137
|
-
class="bal-ba-glass-panel bal-ba-glass-pop bal-ba-glass-lifetime bas-box-border bas-w-[334px] bas-p-4"
|
|
138
|
-
>
|
|
139
|
-
<div class="bal-ba-glass-modal-head">
|
|
140
|
-
<button
|
|
141
|
-
type="button"
|
|
142
|
-
id="txn-lifetime-close"
|
|
143
|
-
[attr.aria-label]="t('close')"
|
|
144
|
-
class="bal-ba-glass-close"
|
|
145
|
-
(click)="closeLifetime()"
|
|
146
|
-
>
|
|
147
|
-
<svg
|
|
148
|
-
viewBox="0 0 10 10"
|
|
149
|
-
fill="none"
|
|
150
|
-
stroke="currentColor"
|
|
151
|
-
stroke-width="1.6"
|
|
152
|
-
stroke-linecap="round"
|
|
153
|
-
aria-hidden="true"
|
|
154
|
-
>
|
|
155
|
-
<path d="M2 2l6 6M8 2 2 8" />
|
|
156
|
-
</svg>
|
|
157
|
-
</button>
|
|
158
|
-
</div>
|
|
159
|
-
<ba-lifetime-slider-base
|
|
160
|
-
id="txn-lifetime-slider"
|
|
161
|
-
[sliderValue]="lifetimeSign()"
|
|
162
|
-
[step]="1"
|
|
163
|
-
[min]="minLifetime()"
|
|
164
|
-
[max]="maxLifetime()"
|
|
165
|
-
[timeInputValue]="lifetimeTimeValue()"
|
|
166
|
-
[isOpen]="isTimePickerOpen()"
|
|
167
|
-
[isTimePickerInsideModal]="true"
|
|
168
|
-
modalId="txns-overview"
|
|
169
|
-
timePickerDropdownDirection="down"
|
|
170
|
-
classNames="bal-ba-glass-lifetime-body"
|
|
171
|
-
timePickerContainerClassNames="bal-ba-glass-time bas-flex bas-w-full bas-items-center bas-justify-center"
|
|
172
|
-
sliderContainerClassNames="bal-ba-glass-slider"
|
|
173
|
-
(sliderValueChanged)="onLifetimeValueChanged($event)"
|
|
174
|
-
(timeChanged)="onLifetimeValueChanged($event)"
|
|
175
|
-
(isOpenChange)="isTimePickerOpen.set($event)"
|
|
176
|
-
(toggleTimerDropdown)="toggleTimerDropdown()"
|
|
177
|
-
/>
|
|
178
|
-
<button
|
|
179
|
-
type="button"
|
|
180
|
-
id="txn-lifetime-accept"
|
|
181
|
-
class="bal-ba-glass-action bal-ba-glass-action-primary"
|
|
182
|
-
(click)="closeLifetime()"
|
|
183
|
-
>
|
|
184
|
-
{{ acceptTxtResolved() }}
|
|
185
|
-
</button>
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
<div
|
|
191
|
-
class="bal-ba-glass-rise bas-flex bas-w-full bas-flex-col bas-gap-8 bas-pb-4"
|
|
192
|
-
>
|
|
193
|
-
<div
|
|
194
|
-
data-testid="txn-pptc-toggle"
|
|
195
|
-
[class]="
|
|
196
|
-
'bal-ba-glass-consent bas-group bas-box-border bas-flex bas-h-fit bas-w-full bas-flex-row bas-items-center bas-gap-3 bas-p-[5px] bas-pl-[9px]' +
|
|
197
|
-
(pptcAccepted() ? ' bal-ba-glass-consent-checked' : '') +
|
|
198
|
-
(acceptHint() === 'privacyPolicy' ? ' bal-ba-head-shake' : '')
|
|
199
|
-
"
|
|
200
|
-
(click)="pptcAccepted.set(!pptcAccepted())"
|
|
201
|
-
>
|
|
202
|
-
<div class="bas-flex bas-h-full bas-items-center bas-pb-1">
|
|
203
|
-
<label
|
|
204
|
-
for="txn-pptc-checkbox"
|
|
205
|
-
class="bal-ba-transition-3 bas-group bas-relative bas-flex bas-cursor-default bas-flex-row bas-items-center bas-gap-[5px] bas-text-sm bas-text-[var(--bal-primary-600)] hover:bas-text-[#003366]"
|
|
206
|
-
>
|
|
207
|
-
<input
|
|
208
|
-
type="checkbox"
|
|
209
|
-
id="txn-pptc-checkbox"
|
|
210
|
-
data-testid="checkbox-animated"
|
|
211
|
-
[checked]="pptcAccepted()"
|
|
212
|
-
class="bal-ba-checkbox-animated-input bal-ba-outline-none bas-peer bas-hidden"
|
|
213
|
-
(change)="pptcAccepted.set(!pptcAccepted())"
|
|
214
|
-
/>
|
|
215
|
-
<span
|
|
216
|
-
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"
|
|
217
|
-
></span>
|
|
218
|
-
</label>
|
|
219
|
-
</div>
|
|
220
|
-
<div
|
|
221
|
-
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)]"
|
|
222
|
-
>
|
|
223
|
-
<div class="bas-flex bas-flex-row bas-items-center bas-gap-1">
|
|
224
|
-
<p class="bal-ba-transition-2 bas-m-0 bas-cursor-default">
|
|
225
|
-
{{ iAuthorizeTheTxtResolved() }}
|
|
226
|
-
</p>
|
|
227
|
-
<button
|
|
228
|
-
type="button"
|
|
229
|
-
data-testid="btn-privacy-policy"
|
|
230
|
-
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)]"
|
|
231
|
-
(click)="openPrivacyPolicy()"
|
|
232
|
-
>
|
|
233
|
-
{{ privacyPolicyTxtResolved() }}
|
|
234
|
-
</button>
|
|
235
|
-
<p class="bal-ba-transition-2 bas-m-0 bas-cursor-default">
|
|
236
|
-
{{ andTheTxtResolved() }}
|
|
237
|
-
</p>
|
|
238
|
-
</div>
|
|
239
|
-
<button
|
|
240
|
-
type="button"
|
|
241
|
-
data-testid="btn-terms-and-conditions"
|
|
242
|
-
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)]"
|
|
243
|
-
(click)="openTermsAndConditions()"
|
|
244
|
-
>
|
|
245
|
-
{{ termsAndConditionsTxtResolved() }}
|
|
246
|
-
</button>
|
|
247
|
-
</div>
|
|
248
|
-
</div>
|
|
249
|
-
<div
|
|
250
|
-
class="bas-flex bas-w-full bas-flex-row bas-items-center bas-justify-between bas-gap-2"
|
|
251
|
-
>
|
|
252
|
-
<button
|
|
253
|
-
type="button"
|
|
254
|
-
id="btn-txn-reject"
|
|
255
|
-
class="bal-ba-glass-action bal-ba-glass-action-reject bas-group bas-box-border bas-flex bas-h-[42px] bas-w-full bas-cursor-pointer bas-flex-row bas-items-center bas-justify-center bas-gap-2 bas-px-2.5 bas-py-0"
|
|
256
|
-
(click)="onTxnRejectClicked()"
|
|
257
|
-
>
|
|
258
|
-
<span
|
|
259
|
-
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"
|
|
260
|
-
>
|
|
261
|
-
{{ rejectTxtResolved() }}
|
|
262
|
-
</span>
|
|
263
|
-
</button>
|
|
264
|
-
<div
|
|
265
|
-
data-testid="txn-accept-wrapper"
|
|
266
|
-
class="bas-flex bas-w-full"
|
|
267
|
-
(mouseenter)="showAcceptHint.set(true)"
|
|
268
|
-
(mouseleave)="showAcceptHint.set(false)"
|
|
269
|
-
(focusin)="showAcceptHint.set(true)"
|
|
270
|
-
(focusout)="showAcceptHint.set(false)"
|
|
271
|
-
>
|
|
272
|
-
<button
|
|
273
|
-
type="button"
|
|
274
|
-
id="btn-txn-accept"
|
|
275
|
-
[disabled]="isAcceptDisabled()"
|
|
276
|
-
class="bal-ba-glass-action bal-ba-glass-action-accept bas-group bas-box-border bas-flex bas-h-[42px] bas-w-full bas-cursor-pointer bas-flex-row bas-items-center bas-justify-center bas-gap-2 bas-px-2.5 bas-py-0"
|
|
277
|
-
(click)="onTxnAcceptClicked()"
|
|
278
|
-
>
|
|
279
|
-
<span
|
|
280
|
-
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"
|
|
281
|
-
>
|
|
282
|
-
{{ acceptTxtResolved() }}
|
|
283
|
-
</span>
|
|
284
|
-
</button>
|
|
285
|
-
</div>
|
|
286
|
-
</div>
|
|
287
|
-
</div>
|
|
288
|
-
</div>
|
|
289
|
-
`,
|
|
290
|
-
})
|
|
291
|
-
export class TxnComponent {
|
|
292
|
-
permissionsRequiredTxt = input<string>();
|
|
293
|
-
solicitedDataTxt = input<string>();
|
|
294
|
-
rejectTxt = input<string>();
|
|
295
|
-
acceptTxt = input<string>();
|
|
296
|
-
iAuthorizeTheTxt = input<string>();
|
|
297
|
-
privacyPolicyTxt = input<string>();
|
|
298
|
-
andTheTxt = input<string>();
|
|
299
|
-
termsAndConditionsTxt = input<string>();
|
|
300
|
-
configureSessionTimeTxt = input<string>();
|
|
301
|
-
hasSolicitedData = input(false);
|
|
302
|
-
allRequiredFilled = input(true);
|
|
303
|
-
solicitedDataPending = input<boolean>();
|
|
304
|
-
closeTxns = input<() => void>(() => {});
|
|
305
|
-
/** Session lifetime in seconds (default 3600). */
|
|
306
|
-
lifetime = input(3600);
|
|
307
|
-
/** Pre-params from the selected transaction (used for validation). */
|
|
308
|
-
selectedTxnPreParams = input<TxnPreParams>({});
|
|
309
|
-
/** User-provided parameter values for solicited data. */
|
|
310
|
-
userParamValues = input<Record<string, string>>({});
|
|
311
|
-
grantedParams = input<string[]>([]);
|
|
312
|
-
revokedParams = input<string[]>([]);
|
|
313
|
-
/** Callback when an error occurs during accept validation. */
|
|
314
|
-
addError = input<(messageSlug: string) => void>(() => {});
|
|
315
|
-
|
|
316
|
-
permissionsRequiredClicked = output<void>();
|
|
317
|
-
solicitedDataClicked = output<void>();
|
|
318
|
-
|
|
319
|
-
private readonly client = injectBlockAuthClient();
|
|
320
|
-
private readonly locale = injectStore($locale);
|
|
321
|
-
protected t = (key: TextKey): string => translate(key, this.locale());
|
|
322
|
-
|
|
323
|
-
protected readonly permissionsRequiredTxtResolved = computed(
|
|
324
|
-
() => this.permissionsRequiredTxt() ?? this.t('permissionsRequired'),
|
|
325
|
-
);
|
|
326
|
-
protected readonly solicitedDataTxtResolved = computed(
|
|
327
|
-
() => this.solicitedDataTxt() ?? this.t('solicitedData'),
|
|
328
|
-
);
|
|
329
|
-
protected readonly rejectTxtResolved = computed(
|
|
330
|
-
() => this.rejectTxt() ?? this.t('reject'),
|
|
331
|
-
);
|
|
332
|
-
protected readonly acceptTxtResolved = computed(
|
|
333
|
-
() => this.acceptTxt() ?? this.t('accept'),
|
|
334
|
-
);
|
|
335
|
-
protected readonly iAuthorizeTheTxtResolved = computed(
|
|
336
|
-
() => this.iAuthorizeTheTxt() ?? this.t('iAuthorizeThe'),
|
|
337
|
-
);
|
|
338
|
-
protected readonly privacyPolicyTxtResolved = computed(
|
|
339
|
-
() => this.privacyPolicyTxt() ?? this.t('privacyPolicy'),
|
|
340
|
-
);
|
|
341
|
-
protected readonly andTheTxtResolved = computed(
|
|
342
|
-
() => this.andTheTxt() ?? this.t('andThe'),
|
|
343
|
-
);
|
|
344
|
-
protected readonly termsAndConditionsTxtResolved = computed(
|
|
345
|
-
() => this.termsAndConditionsTxt() ?? this.t('termsAndConditions'),
|
|
346
|
-
);
|
|
347
|
-
protected readonly configureSessionTimeTxtResolved = computed(
|
|
348
|
-
() => this.configureSessionTimeTxt() ?? this.t('configureSessionTime'),
|
|
349
|
-
);
|
|
350
|
-
|
|
351
|
-
protected readonly pptcAccepted = signal(false);
|
|
352
|
-
protected readonly showLifetime = signal(false);
|
|
353
|
-
protected readonly showAcceptHint = signal(false);
|
|
354
|
-
protected readonly isAcceptDisabled = computed(
|
|
355
|
-
() => !this.pptcAccepted() || !this.allRequiredFilled(),
|
|
356
|
-
);
|
|
357
|
-
protected readonly acceptHint = computed<
|
|
358
|
-
'privacyPolicy' | 'solicitedData' | null
|
|
359
|
-
>(() => {
|
|
360
|
-
if (!this.showAcceptHint() || !this.isAcceptDisabled()) return null;
|
|
361
|
-
return this.pptcAccepted() ? 'solicitedData' : 'privacyPolicy';
|
|
362
|
-
});
|
|
363
|
-
protected readonly showSolicitedArrows = computed(
|
|
364
|
-
() =>
|
|
365
|
-
this.solicitedDataPending() ??
|
|
366
|
-
(this.hasSolicitedData() && !this.allRequiredFilled()),
|
|
367
|
-
);
|
|
368
|
-
|
|
369
|
-
private readonly lifetimeData = computed(
|
|
370
|
-
() => this.selectedTxnPreParams().lifetime ?? {},
|
|
371
|
-
);
|
|
372
|
-
protected readonly minLifetime = computed(
|
|
373
|
-
() => this.lifetimeData().min ?? 10,
|
|
374
|
-
);
|
|
375
|
-
protected readonly maxLifetime = computed(
|
|
376
|
-
() => this.lifetimeData().max ?? 29100,
|
|
377
|
-
);
|
|
378
|
-
protected readonly lifetimeSign = signal(this.lifetime());
|
|
379
|
-
// El TimePicker refleja `lifetimeSign` como string HH:MM:SS; tanto el slider
|
|
380
|
-
// como el picker reportan en segundos, así un único handler mantiene ambos
|
|
381
|
-
// en sync.
|
|
382
|
-
protected readonly lifetimeTimeValue = signal(getTimeBySec(this.lifetime()));
|
|
383
|
-
protected readonly isTimePickerOpen = signal(false);
|
|
384
|
-
protected readonly isLifetimeConfigured = signal(false);
|
|
385
|
-
|
|
386
|
-
private autoCloseTimeout: ReturnType<typeof setTimeout> | undefined;
|
|
387
|
-
|
|
388
|
-
constructor() {
|
|
389
|
-
// Init lifetimeSign/lifetimeTimeValue from the selected txn's lifetime value
|
|
390
|
-
// (or the default).
|
|
391
|
-
const initialLifetime = this.lifetimeData().value ?? this.lifetime();
|
|
392
|
-
this.lifetimeSign.set(initialLifetime);
|
|
393
|
-
this.lifetimeTimeValue.set(getTimeBySec(initialLifetime));
|
|
394
|
-
inject(DestroyRef).onDestroy(() => {
|
|
395
|
-
if (this.autoCloseTimeout) clearTimeout(this.autoCloseTimeout);
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
onSolicitedDataClick(): void {
|
|
400
|
-
if (this.hasSolicitedData()) this.solicitedDataClicked.emit();
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
toggleTimerDropdown(): void {
|
|
404
|
-
this.isTimePickerOpen.update((v) => !v);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// El slider y el TimePicker reportan en segundos; un único handler mantiene
|
|
408
|
-
// ambas vistas (número + HH:MM:SS) en sync.
|
|
409
|
-
onLifetimeValueChanged(value: number): void {
|
|
410
|
-
this.lifetimeSign.set(value);
|
|
411
|
-
this.lifetimeTimeValue.set(getTimeBySec(value));
|
|
412
|
-
this.isLifetimeConfigured.set(true);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
closeLifetime(): void {
|
|
416
|
-
this.isTimePickerOpen.set(false);
|
|
417
|
-
this.showLifetime.set(false);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
openPrivacyPolicy(): void {
|
|
421
|
-
if (typeof window !== 'undefined')
|
|
422
|
-
window.open('https://block-auth.io/politica-de-privacidad/', '_blank');
|
|
423
|
-
}
|
|
424
|
-
openTermsAndConditions(): void {
|
|
425
|
-
if (typeof window !== 'undefined')
|
|
426
|
-
window.open('https://block-auth.io/aviso-legal/', '_blank');
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// Solo resetea flags locales/UI y cierra el modal.
|
|
430
|
-
// NO cancela la txn (ver comentario de cabecera).
|
|
431
|
-
private close(): void {
|
|
432
|
-
this.pptcAccepted.set(false);
|
|
433
|
-
this.client.state.$ui.setKey('isAcceptingTxn', false);
|
|
434
|
-
this.client.closeModal();
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
onTxnRejectClicked(): void {
|
|
438
|
-
this.client.txns.reject();
|
|
439
|
-
this.close();
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
onTxnAcceptClicked(): void {
|
|
443
|
-
const preParams = this.selectedTxnPreParams();
|
|
444
|
-
if (!preParams) return this.addError()('no_transactions_params_found');
|
|
445
|
-
if (!preParams.appKey) return this.addError()('no_app_key_found');
|
|
446
|
-
if (!preParams.to) return this.addError()('no_contract_address_found');
|
|
447
|
-
this.client.state.$ui.setKey('acceptTxnError', null);
|
|
448
|
-
this.client.state.$ui.setKey('isAcceptingTxn', true);
|
|
449
|
-
this.client.txns.accept({
|
|
450
|
-
lifetime: this.lifetimeSign(),
|
|
451
|
-
userParams: this.userParamValues(),
|
|
452
|
-
grantedParams: this.grantedParams(),
|
|
453
|
-
revokedParams: this.revokedParams(),
|
|
454
|
-
});
|
|
455
|
-
// Auto-close after 4s if txns are cleared (matches original behaviour).
|
|
456
|
-
this.autoCloseTimeout = setTimeout(() => {
|
|
457
|
-
const requests = this.client.state.$ws.get().requests;
|
|
458
|
-
if (requests && requests.length === 0) this.close();
|
|
459
|
-
}, 4000);
|
|
460
|
-
}
|
|
461
|
-
}
|