@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.
Files changed (153) hide show
  1. package/fesm2022/block-auth.io-angular.mjs +9828 -0
  2. package/fesm2022/block-auth.io-angular.mjs.map +1 -0
  3. package/index.d.ts +1144 -0
  4. package/package.json +16 -37
  5. package/.turbo/turbo-build.log +0 -37
  6. package/.turbo/turbo-lint.log +0 -4
  7. package/.turbo/turbo-test.log +0 -2001
  8. package/.turbo/turbo-typecheck.log +0 -19
  9. package/CHANGELOG.md +0 -245
  10. package/ng-package.json +0 -6
  11. package/scripts/css-to-ts.mjs +0 -14
  12. package/src/lib/__tests__/integration.test.ts +0 -45
  13. package/src/lib/block-auth.service.test.ts +0 -69
  14. package/src/lib/block-auth.service.ts +0 -81
  15. package/src/lib/components/btns/btn-base-provider.component.test.ts +0 -22
  16. package/src/lib/components/btns/btn-base-provider.component.ts +0 -55
  17. package/src/lib/components/btns/btn-block-auth.component.test.ts +0 -105
  18. package/src/lib/components/btns/btn-block-auth.component.ts +0 -117
  19. package/src/lib/components/btns/btn-gmail.component.test.ts +0 -16
  20. package/src/lib/components/btns/btn-gmail.component.ts +0 -41
  21. package/src/lib/components/btns/btn-google-base.component.test.ts +0 -16
  22. package/src/lib/components/btns/btn-google-base.component.ts +0 -73
  23. package/src/lib/components/btns/btn-metamask.component.test.ts +0 -20
  24. package/src/lib/components/btns/btn-metamask.component.ts +0 -98
  25. package/src/lib/components/btns/btn-microsoft.component.test.ts +0 -16
  26. package/src/lib/components/btns/btn-microsoft.component.ts +0 -77
  27. package/src/lib/components/btns/btn-phantom.component.test.ts +0 -20
  28. package/src/lib/components/btns/btn-phantom.component.ts +0 -93
  29. package/src/lib/components/btns/btn-signin.component.test.ts +0 -55
  30. package/src/lib/components/btns/btn-signin.component.ts +0 -108
  31. package/src/lib/components/btns/btn-wallet-connect.component.test.ts +0 -20
  32. package/src/lib/components/btns/btn-wallet-connect.component.ts +0 -109
  33. package/src/lib/components/btns/index.ts +0 -11
  34. package/src/lib/components/contents/content-signin.component.test.ts +0 -33
  35. package/src/lib/components/contents/content-signin.component.ts +0 -68
  36. package/src/lib/components/contents/content-signup.component.test.ts +0 -86
  37. package/src/lib/components/contents/content-signup.component.ts +0 -234
  38. package/src/lib/components/dds/change-account.component.test.ts +0 -66
  39. package/src/lib/components/dds/change-account.component.ts +0 -112
  40. package/src/lib/components/dds/dropdown-profile-btn.component.test.ts +0 -66
  41. package/src/lib/components/dds/dropdown-profile-btn.component.ts +0 -170
  42. package/src/lib/components/dds/dropdown-profile-item.component.test.ts +0 -75
  43. package/src/lib/components/dds/dropdown-profile-item.component.ts +0 -74
  44. package/src/lib/components/dds/dropdown-profile.component.test.ts +0 -110
  45. package/src/lib/components/dds/dropdown-profile.component.ts +0 -264
  46. package/src/lib/components/flow-block-auth.component.test.ts +0 -93
  47. package/src/lib/components/flow-block-auth.component.ts +0 -226
  48. package/src/lib/components/modals/modal-overlay.component.test.ts +0 -81
  49. package/src/lib/components/modals/modal-overlay.component.ts +0 -43
  50. package/src/lib/components/modals/modal-restoration-expired.component.test.ts +0 -71
  51. package/src/lib/components/modals/modal-restoration-expired.component.ts +0 -83
  52. package/src/lib/components/modals/modal-restore.component.test.ts +0 -74
  53. package/src/lib/components/modals/modal-restore.component.ts +0 -104
  54. package/src/lib/components/modals/modal-signin.component.test.ts +0 -66
  55. package/src/lib/components/modals/modal-signin.component.ts +0 -44
  56. package/src/lib/components/modals/modal-signup.component.test.ts +0 -56
  57. package/src/lib/components/modals/modal-signup.component.ts +0 -40
  58. package/src/lib/components/sections/footer-section.component.test.ts +0 -19
  59. package/src/lib/components/sections/footer-section.component.ts +0 -49
  60. package/src/lib/components/sections/internals/providers-buttons.component.test.ts +0 -27
  61. package/src/lib/components/sections/internals/providers-buttons.component.ts +0 -290
  62. package/src/lib/components/sections/internals/providers-filters.component.test.ts +0 -25
  63. package/src/lib/components/sections/internals/providers-filters.component.ts +0 -139
  64. package/src/lib/components/sections/internals/selected-button.component.test.ts +0 -36
  65. package/src/lib/components/sections/internals/selected-button.component.ts +0 -92
  66. package/src/lib/components/sections/login-section.component.test.ts +0 -49
  67. package/src/lib/components/sections/login-section.component.ts +0 -120
  68. package/src/lib/components/sections/providers-section.component.test.ts +0 -22
  69. package/src/lib/components/sections/providers-section.component.ts +0 -187
  70. package/src/lib/components/txns/internals/permissions-required-modal.component.test.ts +0 -36
  71. package/src/lib/components/txns/internals/permissions-required-modal.component.ts +0 -43
  72. package/src/lib/components/txns/internals/phone-input.component.test.ts +0 -119
  73. package/src/lib/components/txns/internals/phone-input.component.ts +0 -301
  74. package/src/lib/components/txns/internals/solicited-data-modal.component.test.ts +0 -661
  75. package/src/lib/components/txns/internals/solicited-data-modal.component.ts +0 -415
  76. package/src/lib/components/txns/internals/txn-error.component.test.ts +0 -127
  77. package/src/lib/components/txns/internals/txn-error.component.ts +0 -144
  78. package/src/lib/components/txns/internals/txn-type.component.test.ts +0 -52
  79. package/src/lib/components/txns/internals/txn-type.component.ts +0 -51
  80. package/src/lib/components/txns/internals/txn.component.test.ts +0 -580
  81. package/src/lib/components/txns/internals/txn.component.ts +0 -461
  82. package/src/lib/components/txns/txns-overview.component.test.ts +0 -421
  83. package/src/lib/components/txns/txns-overview.component.ts +0 -424
  84. package/src/lib/icons/ai-outline-disconnect.component.ts +0 -21
  85. package/src/lib/icons/bi-logo-gmail.component.ts +0 -21
  86. package/src/lib/icons/cg-profile.component.ts +0 -31
  87. package/src/lib/icons/check-icon.component.ts +0 -27
  88. package/src/lib/icons/ci-clock2.component.ts +0 -31
  89. package/src/lib/icons/fa-arrow-right.component.ts +0 -21
  90. package/src/lib/icons/fa-times.component.ts +0 -21
  91. package/src/lib/icons/fa-undo.component.ts +0 -21
  92. package/src/lib/icons/icons.test.ts +0 -25
  93. package/src/lib/icons/index.ts +0 -22
  94. package/src/lib/icons/io-ios-arrow-back.component.ts +0 -21
  95. package/src/lib/icons/io-ios-arrow-forward.component.ts +0 -21
  96. package/src/lib/icons/io-md-arrow-back.component.ts +0 -19
  97. package/src/lib/icons/io-md-arrow-forward.component.ts +0 -19
  98. package/src/lib/icons/pi-warning-fill.component.ts +0 -21
  99. package/src/lib/icons/tb-arrows-exchange2.component.ts +0 -30
  100. package/src/lib/icons/tb-copy-check-filled.component.ts +0 -21
  101. package/src/lib/icons/tb-copy.component.ts +0 -34
  102. package/src/lib/icons/ti-vendor-microsoft.component.ts +0 -21
  103. package/src/lib/inject-store.test.ts +0 -26
  104. package/src/lib/inject-store.ts +0 -16
  105. package/src/lib/primitives/arrow-icon.component.test.ts +0 -25
  106. package/src/lib/primitives/arrow-icon.component.ts +0 -45
  107. package/src/lib/primitives/btn-arrow-dir.component.test.ts +0 -22
  108. package/src/lib/primitives/btn-arrow-dir.component.ts +0 -65
  109. package/src/lib/primitives/btn-base.component.test.ts +0 -38
  110. package/src/lib/primitives/btn-base.component.ts +0 -140
  111. package/src/lib/primitives/divider-base.component.test.ts +0 -12
  112. package/src/lib/primitives/divider-base.component.ts +0 -74
  113. package/src/lib/primitives/dropdown-arrow.component.test.ts +0 -12
  114. package/src/lib/primitives/dropdown-arrow.component.ts +0 -46
  115. package/src/lib/primitives/dropdown-base.component.test.ts +0 -49
  116. package/src/lib/primitives/dropdown-base.component.ts +0 -329
  117. package/src/lib/primitives/helpers.ts +0 -151
  118. package/src/lib/primitives/horizontal-loader.component.test.ts +0 -19
  119. package/src/lib/primitives/horizontal-loader.component.ts +0 -70
  120. package/src/lib/primitives/icon-base.component.test.ts +0 -19
  121. package/src/lib/primitives/icon-base.component.ts +0 -58
  122. package/src/lib/primitives/img-loader.component.test.ts +0 -12
  123. package/src/lib/primitives/img-loader.component.ts +0 -118
  124. package/src/lib/primitives/index.ts +0 -29
  125. package/src/lib/primitives/input-base.component.test.ts +0 -20
  126. package/src/lib/primitives/input-base.component.ts +0 -210
  127. package/src/lib/primitives/lifetime-slider-base.component.test.ts +0 -88
  128. package/src/lib/primitives/lifetime-slider-base.component.ts +0 -75
  129. package/src/lib/primitives/oval-spinner.component.test.ts +0 -9
  130. package/src/lib/primitives/oval-spinner.component.ts +0 -158
  131. package/src/lib/primitives/pickers/dropdown-picker-animated-base.component.ts +0 -220
  132. package/src/lib/primitives/pickers/picker-button.component.ts +0 -74
  133. package/src/lib/primitives/pickers/time-picker-dropdown-selector.component.ts +0 -188
  134. package/src/lib/primitives/pickers/time-picker.component.ts +0 -124
  135. package/src/lib/primitives/pickers/time-unit-selector.component.ts +0 -82
  136. package/src/lib/primitives/progressbar.component.test.ts +0 -18
  137. package/src/lib/primitives/progressbar.component.ts +0 -93
  138. package/src/lib/primitives/providersStyles.ts +0 -268
  139. package/src/lib/primitives/slider-base.component.ts +0 -56
  140. package/src/lib/provide-block-auth.test.ts +0 -43
  141. package/src/lib/provide-block-auth.ts +0 -43
  142. package/src/lib/runtime/block-auth-runtime.directive.test.ts +0 -89
  143. package/src/lib/runtime/block-auth-runtime.directive.ts +0 -68
  144. package/src/lib/teleport-body.directive.test.ts +0 -29
  145. package/src/lib/teleport-body.directive.ts +0 -21
  146. package/src/lib/testing.ts +0 -15
  147. package/src/lib/transitions.css +0 -23
  148. package/src/public-api.ts +0 -86
  149. package/src/vitest.setup.ts +0 -8
  150. package/tailwind.config.cjs +0 -6
  151. package/tsconfig.json +0 -15
  152. package/tsconfig.lib.json +0 -9
  153. package/vite.config.mts +0 -44
@@ -1,424 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- computed,
5
- effect,
6
- input,
7
- signal,
8
- untracked,
9
- } from '@angular/core';
10
- import {
11
- $extension,
12
- $locale,
13
- openExtensionOnTxn,
14
- t as translate,
15
- type TextKey,
16
- type TxnDataRequest,
17
- } from '@block-auth.io/core';
18
- import { injectBlockAuthClient } from '../../provide-block-auth';
19
- import { injectStore } from '../../inject-store';
20
- import { TxnComponent } from './internals/txn.component';
21
- import { TxnTypeComponent } from './internals/txn-type.component';
22
- import { TxnErrorComponent } from './internals/txn-error.component';
23
- import { PermissionsRequiredModalComponent } from './internals/permissions-required-modal.component';
24
- import {
25
- SolicitedDataModalComponent,
26
- type ParamChange,
27
- type ShareChange,
28
- } from './internals/solicited-data-modal.component';
29
- import { CiClock2Component, FaArrowRightComponent } from '../../icons';
30
- import {
31
- EMPTY_SOLICITED_DATA_FORM,
32
- getSolicitedAcceptParams,
33
- getSolicitedFields,
34
- getSolicitedParams,
35
- isSolicitedDataComplete,
36
- saveSolicitedValue,
37
- setSolicitedShared,
38
- setSolicitedValue,
39
- undoSolicitedValue,
40
- type SolicitedDataForm,
41
- type SolicitedParam,
42
- } from '@block-auth.io/core';
43
-
44
- // Orquestador de txns: lee las solicitudes pendientes de `$ws.requests` y la
45
- // config de UI de `$ui.uiConfig` (vía injectStore). Se conserva la navegación
46
- // prev/next, la composición de overlays permisos/datos-solicitados, la
47
- // derivación de required/optional params desde `uiConfig` y las clases `bas-`.
48
- // Se elimina los wrappers framer-motion.
49
- interface TxnPreParams {
50
- iconUrl?: string;
51
- domain?: string;
52
- appName?: string;
53
- txnType?: string;
54
- appKey?: string;
55
- to?: string;
56
- lifetime?: { value?: number; min?: number; max?: number };
57
- [key: string]: unknown;
58
- }
59
-
60
- const accountShort = (addr: string | null | undefined): string =>
61
- addr && addr.length > 10
62
- ? `${addr.slice(0, 6)}…${addr.slice(-4)}`
63
- : addr ?? '';
64
-
65
- const TXN_ERROR_TEXT_KEYS: Record<string, TextKey> = {
66
- no_transactions_found: 'noTransactionsFound',
67
- no_app_key_found: 'noAppKeyFound',
68
- no_contract_address_found: 'noContractAddressFound',
69
- no_transactions_params_found: 'noTransactionsParamsFound',
70
- unknown: 'somethingWentWrong',
71
- };
72
-
73
- @Component({
74
- selector: 'ba-txns-overview',
75
- standalone: true,
76
- changeDetection: ChangeDetectionStrategy.OnPush,
77
- imports: [
78
- TxnComponent,
79
- TxnTypeComponent,
80
- TxnErrorComponent,
81
- PermissionsRequiredModalComponent,
82
- SolicitedDataModalComponent,
83
- CiClock2Component,
84
- FaArrowRightComponent,
85
- ],
86
- template: `
87
- <div
88
- data-testid="txns-overview"
89
- class="bas-flex bas-box-border bas-relative bas-h-full bas-w-full bas-gap-6 bas-flex-col bas-items-center bas-p-6 bas-font-medium bas-justify-center"
90
- >
91
- @if (isEmpty() && isSigning() && !isOtpRequired()) {
92
- <ba-txn-error
93
- [errorMessageTxt]="t('noTransactionsFound')"
94
- errorMessageSlug="no_transactions_found"
95
- [closeTxns]="closeTxns()"
96
- [isCountdown]="false"
97
- />
98
- } @else if (!isEmpty() && error().value) {
99
- <ba-txn-error
100
- [errorMessageTxt]="errorText()"
101
- [errorMessageSlug]="error().messageSlug"
102
- [closeTxns]="closeTxns()"
103
- [isCountdown]="false"
104
- />
105
- } @else if (!isEmpty() || isOtpRequired()) {
106
- <!-- No txn yet when the session expired before it was created. -->
107
- @if (!isEmpty()) {
108
- <div
109
- class="bal-ba-glass-rise bas-flex bas-flex-col bas-items-center bas-gap-3"
110
- >
111
- <img
112
- [src]="
113
- preParams().iconUrl ||
114
- 'https://dashboard.block-auth.io/img/blockauth_logo.png'
115
- "
116
- class="bal-ba-glass-logo bas-h-16"
117
- alt="app logo"
118
- />
119
- <h2 class="bas-m-0 bas-text-base bas-text-[var(--bal-primary-600)]">
120
- {{ preParams().domain || 'dashboard.block-auth.io' }}
121
- </h2>
122
- <p class="bas-m-0 bas-text-lg bas-text-[var(--bal-primary-800)]">
123
- {{ preParams().appName || 'Block-Auth' }}
124
- <span class="bas-text-base bas-text-[var(--bal-primary-500)]">{{
125
- t('solicitsTo')
126
- }}</span>
127
- {{ accountShort(did()) }}
128
- </p>
129
- </div>
130
- <ba-txn-type
131
- [txnType]="preParams().txnType || t('login')"
132
- [txnsLength]="txns().length"
133
- (prevTxnClicked)="onPrevTxnClicked()"
134
- (nextTxnClicked)="onNextTxnClicked()"
135
- />
136
- }
137
- <!-- The server refuses this page's accept while the OTP window is
138
- over: the code is entered in the extension, which approves. -->
139
- @if (isOtpRequired()) {
140
- <div
141
- class="bas-flex bas-w-full bas-max-w-[300px] bas-flex-col bas-items-center bas-gap-6 bas-text-center"
142
- >
143
- <span
144
- class="bas-flex bas-h-16 bas-w-16 bas-items-center bas-justify-center bas-rounded-full bas-border bas-border-solid bas-border-[var(--bal-primary-50)] bas-bg-[var(--bal-primary-10)]"
145
- >
146
- <ba-ci-clock2 class="bas-h-8 bas-w-8 bas-text-[var(--bal-primary-600)]" />
147
- </span>
148
- <div class="bas-flex bas-flex-col bas-gap-2">
149
- <h3 class="bas-m-0 bas-text-lg bas-font-semibold bas-text-[var(--bal-primary-900)]">
150
- {{ t('otpExpiredTitle') }}
151
- </h3>
152
- <p class="bas-m-0 bas-text-sm bas-leading-relaxed bas-text-[#475569]">
153
- {{ t(ext().installed ? 'otpExpiredExtension' : 'otpExpiredApp') }}
154
- </p>
155
- </div>
156
- @if (ext().installed) {
157
- <button
158
- type="button"
159
- id="btn-txn-open-extension"
160
- (click)="openExtensionOnTxn()"
161
- class="bas-flex bas-h-11 bas-w-full bas-cursor-pointer bas-items-center bas-justify-center bas-gap-2 bas-rounded-xl bas-border-none bas-bg-[var(--bal-primary-600)] bas-px-4 bas-text-base bas-font-semibold bas-text-white bas-transition-colors bas-duration-200 hover:bas-bg-[var(--bal-primary-800)] focus-visible:bas-outline focus-visible:bas-outline-2 focus-visible:bas-outline-offset-2 focus-visible:bas-outline-[var(--bal-primary-500)]"
162
- >
163
- {{ t('openExtension') }}
164
- <ba-fa-arrow-right class="bas-h-4 bas-w-4" />
165
- </button>
166
- }
167
- </div>
168
- } @else {
169
- <div class="bas-h-[334px] bas-w-full bas-max-w-[330px]">
170
- <ba-txn
171
- [hasSolicitedData]="hasSolicitedData()"
172
- [allRequiredFilled]="allRequiredFilled()"
173
- [solicitedDataPending]="solicitedDataPending()"
174
- [closeTxns]="closeTxns()"
175
- [selectedTxnPreParams]="preParams()"
176
- [userParamValues]="acceptParams().userParams"
177
- [grantedParams]="acceptParams().grantedParams"
178
- [revokedParams]="acceptParams().revokedParams"
179
- [addError]="addError"
180
- (permissionsRequiredClicked)="showPermissions.set(true)"
181
- (solicitedDataClicked)="showSolicitedData.set(true)"
182
- />
183
- </div>
184
- } } @if (showPermissions()) {
185
- <div
186
- class="bal-ba-glass-backdrop bal-ba-backdrop-blur-base bal-ba-backdrop-blur-sm bas-absolute bas-z-30 bas-box-border bas-h-full bas-w-full"
187
- (click)="showPermissions.set(false)"
188
- ></div>
189
- <div class="bas-absolute bas-top-44 bas-z-40">
190
- <ba-permissions-required-modal />
191
- </div>
192
- } @if (showSolicitedData()) {
193
- <div
194
- class="bal-ba-glass-backdrop bal-ba-backdrop-blur-base bal-ba-backdrop-blur-sm bas-absolute bas-z-30 bas-box-border bas-h-full bas-w-full"
195
- (click)="showSolicitedData.set(false)"
196
- ></div>
197
- <ba-solicited-data-modal
198
- class="bal-ba-glass-modal-slot bas-absolute bas-inset-y-6 bas-z-40"
199
- [requiredParams]="requiredParams()"
200
- [optionalParams]="optionalParams()"
201
- [params]="txnData()?.params"
202
- [userParamValues]="solicitedForm().values"
203
- [sharedParams]="solicitedForm().shared"
204
- [savedParams]="solicitedForm().saved"
205
- [errorTxt]="acceptTxnError() ? t('requiredDataError') : undefined"
206
- [closable]="true"
207
- [acceptable]="true"
208
- (paramChange)="handleParamChange($event)"
209
- (shareChange)="handleShareChange($event)"
210
- (saveParam)="handleSaveParam($event)"
211
- (undoParam)="handleUndoParam($event)"
212
- (closed)="showSolicitedData.set(false)"
213
- (accepted)="showSolicitedData.set(false)"
214
- />
215
- }
216
- </div>
217
- `,
218
- })
219
- export class TxnsOverviewComponent {
220
- closeTxns = input<() => void>(() => {});
221
-
222
- private readonly client = injectBlockAuthClient();
223
- private readonly ws = injectStore(this.client.state.$ws);
224
- private readonly ui = injectStore(this.client.state.$ui);
225
- protected readonly ext = injectStore($extension);
226
- private readonly locale = injectStore($locale);
227
- protected t = (key: TextKey): string => translate(key, this.locale());
228
-
229
- protected readonly accountShort = accountShort;
230
-
231
- protected readonly selectedIndex = signal(0);
232
- protected readonly showPermissions = signal(false);
233
- protected readonly showSolicitedData = signal(false);
234
- protected readonly solicitedForm = signal<SolicitedDataForm>(
235
- EMPTY_SOLICITED_DATA_FORM,
236
- );
237
- protected readonly txnData = signal<TxnDataRequest | null>(null);
238
- private readonly isLoadingTxnData = signal(false);
239
- private readonly txnDataReload = signal(0);
240
- protected readonly error = signal<{ value: boolean; messageSlug: string }>({
241
- value: false,
242
- messageSlug: '',
243
- });
244
-
245
- protected readonly txns = computed(() => this.ws().requests ?? []);
246
- protected readonly did = computed(() => this.ws().did);
247
- protected readonly isSigning = computed(() => this.ui().isSigning);
248
- protected readonly isOtpRequired = computed(() => this.ui().isOtpRequired);
249
- protected readonly acceptTxnError = computed(() => this.ui().acceptTxnError);
250
- protected readonly openExtensionOnTxn = openExtensionOnTxn;
251
- protected readonly isEmpty = computed(() => this.txns().length === 0);
252
- protected readonly errorText = computed(() =>
253
- this.t(
254
- TXN_ERROR_TEXT_KEYS[this.error().messageSlug] ??
255
- TXN_ERROR_TEXT_KEYS['unknown'],
256
- ),
257
- );
258
-
259
- private readonly selectedTxn = computed(
260
- () => this.txns()[this.selectedIndex()] ?? this.txns()[0],
261
- );
262
- protected readonly preParams = computed<TxnPreParams>(() => {
263
- const raw = this.selectedTxn()?.['pre_params'] as string | undefined;
264
- if (!raw) return {};
265
- try {
266
- return JSON.parse(raw) as TxnPreParams;
267
- } catch {
268
- return {};
269
- }
270
- });
271
-
272
- private readonly requiredOptionalParams = computed(() => {
273
- const cfg =
274
- (this.ui().uiConfig as { config?: Record<string, unknown> } | null)
275
- ?.config ?? {};
276
- const required: string[] = [];
277
- const optional: string[] = [];
278
- const kycMode = (cfg['modules'] as { kyc?: { mode?: string } } | undefined)
279
- ?.kyc?.mode;
280
- if (kycMode === 'required') required.push('modules-kyc');
281
- else if (kycMode === 'optional') optional.push('modules-kyc');
282
- Object.entries(
283
- (cfg['params'] as Record<string, { mode?: string }>) || {},
284
- ).forEach(([slug, paramCfg]) => {
285
- if (paramCfg.mode === 'required') required.push(slug);
286
- else if (paramCfg.mode === 'optional') optional.push(slug);
287
- });
288
- return { requiredParams: required, optionalParams: optional };
289
- });
290
- protected readonly requiredParams = computed(
291
- () => this.requiredOptionalParams().requiredParams,
292
- );
293
- protected readonly optionalParams = computed(
294
- () => this.requiredOptionalParams().optionalParams,
295
- );
296
- private readonly selectedTxnId = computed(
297
- () => this.selectedTxn()?.['id'] as number | string | undefined,
298
- );
299
- private readonly solicitedParams = computed(() =>
300
- getSolicitedParams({
301
- params: this.txnData()?.params,
302
- requiredParams: this.requiredParams(),
303
- optionalParams: this.optionalParams(),
304
- }),
305
- );
306
- protected readonly hasSolicitedData = computed(() =>
307
- this.txnData()
308
- ? this.solicitedParams().length > 0
309
- : this.requiredParams().length > 0 || this.optionalParams().length > 0,
310
- );
311
- private readonly solicitedFields = computed(() =>
312
- getSolicitedFields(
313
- this.solicitedParams(),
314
- this.solicitedForm(),
315
- !!this.txnData(),
316
- ),
317
- );
318
- private readonly isSolicitedComplete = computed(() =>
319
- isSolicitedDataComplete(this.solicitedFields()),
320
- );
321
- protected readonly allRequiredFilled = computed(
322
- () =>
323
- (!this.isLoadingTxnData() || this.solicitedParams().length === 0) &&
324
- this.isSolicitedComplete(),
325
- );
326
- protected readonly solicitedDataPending = computed(
327
- () =>
328
- this.hasSolicitedData() &&
329
- !this.isLoadingTxnData() &&
330
- !this.isSolicitedComplete(),
331
- );
332
- protected readonly acceptParams = computed(() =>
333
- getSolicitedAcceptParams(this.solicitedFields()),
334
- );
335
-
336
- constructor() {
337
- effect((onCleanup) => {
338
- const txnId = this.selectedTxnId();
339
- this.txnDataReload();
340
- untracked(() => {
341
- this.txnData.set(null);
342
- if (txnId == null) {
343
- this.isLoadingTxnData.set(false);
344
- return;
345
- }
346
- let active = true;
347
- this.isLoadingTxnData.set(true);
348
- Promise.resolve()
349
- .then(() => this.client.txns.dataRequest(txnId))
350
- .catch(() => null)
351
- .then((result) => {
352
- if (!active) return;
353
- this.txnData.set(result ?? null);
354
- this.isLoadingTxnData.set(false);
355
- });
356
- onCleanup(() => {
357
- active = false;
358
- });
359
- });
360
- });
361
-
362
- effect(() => {
363
- if (!this.acceptTxnError()) return;
364
- untracked(() => {
365
- this.showSolicitedData.set(true);
366
- this.txnDataReload.update((n) => n + 1);
367
- });
368
- });
369
-
370
- effect(() => {
371
- this.selectedTxnId();
372
- untracked(() => {
373
- this.solicitedForm.set(EMPTY_SOLICITED_DATA_FORM);
374
- this.client.state.$ui.setKey('acceptTxnError', null);
375
- });
376
- });
377
- }
378
-
379
- // Surfaces an accept-validation error and clears the accepting loader.
380
- addError = (messageSlug = 'unknown'): void => {
381
- this.error.set({ value: true, messageSlug });
382
- this.client.state.$ui.setKey('isAcceptingTxn', false);
383
- };
384
-
385
- private updateParam(
386
- slug: string,
387
- update: (
388
- form: SolicitedDataForm,
389
- item: SolicitedParam,
390
- ) => SolicitedDataForm,
391
- ): void {
392
- const item = this.solicitedParams().find((param) => param.slug === slug);
393
- if (item) this.solicitedForm.update((prev) => update(prev, item));
394
- }
395
-
396
- handleParamChange({ slug, value }: ParamChange): void {
397
- this.updateParam(slug, (form, item) =>
398
- setSolicitedValue(form, item, value),
399
- );
400
- }
401
-
402
- handleShareChange({ slug, shared }: ShareChange): void {
403
- this.solicitedForm.update((prev) => setSolicitedShared(prev, slug, shared));
404
- }
405
-
406
- handleSaveParam(slug: string): void {
407
- this.solicitedForm.update((prev) => saveSolicitedValue(prev, slug));
408
- }
409
-
410
- handleUndoParam(slug: string): void {
411
- this.updateParam(slug, undoSolicitedValue);
412
- }
413
-
414
- onPrevTxnClicked(): void {
415
- const len = this.txns().length;
416
- if (len === 0) return;
417
- this.selectedIndex.update((i) => (i === 0 ? len - 1 : i - 1));
418
- }
419
- onNextTxnClicked(): void {
420
- const len = this.txns().length;
421
- if (len === 0) return;
422
- this.selectedIndex.update((i) => (i === len - 1 ? 0 : i + 1));
423
- }
424
- }
@@ -1,21 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
-
3
- // Icono inline extraído de react-icons/ai (AiOutlineDisconnect), espejo de
4
- // packages/vue/src/icons/AiOutlineDisconnect.vue (mismo `viewBox`/`d`).
5
- // Ver check-icon.component.ts para la explicación del enrutado de `class`.
6
- @Component({
7
- selector: 'ba-ai-outline-disconnect',
8
- standalone: true,
9
- changeDetection: ChangeDetectionStrategy.OnPush,
10
- host: { style: 'display: contents' },
11
- template: `
12
- <svg [class]="class()" viewBox="0 0 1024 1024" fill="currentColor" aria-hidden="true">
13
- <path
14
- d="M832.6 191.4c-84.6-84.6-221.5-84.6-306 0l-96.9 96.9 51 51 96.9-96.9c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204l-96.9 96.9 51.1 51.1 96.9-96.9c84.4-84.6 84.4-221.5-.1-306.1zM446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l96.9-96.9-51.1-51.1-96.9 96.9c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l96.9-96.9-51-51-96.8 97zM260.3 209.4a8.03 8.03 0 0 0-11.3 0L209.4 249a8.03 8.03 0 0 0 0 11.3l554.4 554.4c3.1 3.1 8.2 3.1 11.3 0l39.6-39.6c3.1-3.1 3.1-8.2 0-11.3L260.3 209.4z"
15
- />
16
- </svg>
17
- `,
18
- })
19
- export class AiOutlineDisconnectComponent {
20
- class = input('');
21
- }
@@ -1,21 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
-
3
- // Icono inline extraído de react-icons/bi (BiLogoGmail), espejo de
4
- // packages/vue/src/icons/BiLogoGmail.vue (mismo `viewBox`/`d`).
5
- // Ver check-icon.component.ts para la explicación del enrutado de `class`.
6
- @Component({
7
- selector: 'ba-bi-logo-gmail',
8
- standalone: true,
9
- changeDetection: ChangeDetectionStrategy.OnPush,
10
- host: { style: 'display: contents' },
11
- template: `
12
- <svg [class]="class()" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
13
- <path
14
- d="m18.73 5.41-1.28 1L12 10.46 6.55 6.37l-1.28-1A2 2 0 0 0 2 7.05v11.59A1.36 1.36 0 0 0 3.36 20h3.19v-7.72L12 16.37l5.45-4.09V20h3.19A1.36 1.36 0 0 0 22 18.64V7.05a2 2 0 0 0-3.27-1.64z"
15
- />
16
- </svg>
17
- `,
18
- })
19
- export class BiLogoGmailComponent {
20
- class = input('');
21
- }
@@ -1,31 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
-
3
- // Icono inline extraído de react-icons/cg (CgProfile), espejo de
4
- // packages/vue/src/icons/CgProfile.vue (mismo `viewBox`/`d`, 2 `<path>` con
5
- // `fill-rule`/`clip-rule`).
6
- // Ver check-icon.component.ts para la explicación del enrutado de `class`.
7
- @Component({
8
- selector: 'ba-cg-profile',
9
- standalone: true,
10
- changeDetection: ChangeDetectionStrategy.OnPush,
11
- host: { style: 'display: contents' },
12
- template: `
13
- <svg [class]="class()" viewBox="0 0 24 24" fill="none" aria-hidden="true">
14
- <path
15
- fill-rule="evenodd"
16
- clip-rule="evenodd"
17
- d="M16 9C16 11.2091 14.2091 13 12 13C9.79086 13 8 11.2091 8 9C8 6.79086 9.79086 5 12 5C14.2091 5 16 6.79086 16 9ZM14 9C14 10.1046 13.1046 11 12 11C10.8954 11 10 10.1046 10 9C10 7.89543 10.8954 7 12 7C13.1046 7 14 7.89543 14 9Z"
18
- fill="currentColor"
19
- />
20
- <path
21
- fill-rule="evenodd"
22
- clip-rule="evenodd"
23
- d="M12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1ZM3 12C3 14.0902 3.71255 16.014 4.90798 17.5417C6.55245 15.3889 9.14627 14 12.0645 14C14.9448 14 17.5092 15.3531 19.1565 17.4583C20.313 15.9443 21 14.0524 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12ZM12 21C9.84977 21 7.87565 20.2459 6.32767 18.9878C7.59352 17.1812 9.69106 16 12.0645 16C14.4084 16 16.4833 17.1521 17.7538 18.9209C16.1939 20.2191 14.1881 21 12 21Z"
24
- fill="currentColor"
25
- />
26
- </svg>
27
- `,
28
- })
29
- export class CgProfileComponent {
30
- class = input('');
31
- }
@@ -1,27 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
-
3
- // Icono inline extraído de @heroicons/react/20/solid (CheckIcon), espejo de
4
- // packages/vue/src/icons/CheckIcon.vue (mismo `viewBox`/`d`, ver Task V6).
5
- // `:host { display: contents }` hace que el elemento `ba-check-icon` no
6
- // participe en el layout; el `class` que un consumidor le pase se enruta al
7
- // input `class` (declarado explícitamente) en vez de al atributo del host, y
8
- // se aplica al `<svg>` interno — así el resultado visual/DOM es equivalente
9
- // al de la SFC Vue, donde la clase cae directamente sobre el `<svg>`.
10
- @Component({
11
- selector: 'ba-check-icon',
12
- standalone: true,
13
- changeDetection: ChangeDetectionStrategy.OnPush,
14
- host: { style: 'display: contents' },
15
- template: `
16
- <svg [class]="class()" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
17
- <path
18
- fill-rule="evenodd"
19
- clip-rule="evenodd"
20
- d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z"
21
- />
22
- </svg>
23
- `,
24
- })
25
- export class CheckIconComponent {
26
- class = input('');
27
- }
@@ -1,31 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
-
3
- // Icono inline extraído de `react-icons/ci` (CiClock2), usado por
4
- // `pickers/time-picker.component`. Espejo 1:1 de packages/vue/src/icons/CiClock2.vue
5
- // (mismo viewBox 0 0 24 24, mismos paths) para que un `grep` sobre el nombre
6
- // original siga encontrando el equivalente Angular.
7
- // `:host { display: contents }` + `class` input enrutado al `<svg>`: mismo
8
- // patrón que el resto de iconos (ver check-icon.component).
9
- @Component({
10
- selector: 'ba-ci-clock2',
11
- standalone: true,
12
- changeDetection: ChangeDetectionStrategy.OnPush,
13
- host: { style: 'display: contents' },
14
- template: `
15
- <svg [class]="class()" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
16
- <g id="Clock_2">
17
- <g>
18
- <path
19
- d="M12,21.933A9.933,9.933,0,1,1,21.933,12,9.944,9.944,0,0,1,12,21.933ZM12,3.067A8.933,8.933,0,1,0,20.933,12,8.943,8.943,0,0,0,12,3.067Z"
20
- />
21
- <path
22
- d="M18,12.5H12a.429.429,0,0,1-.34-.14c-.01,0-.01-.01-.02-.02A.429.429,0,0,1,11.5,12V6a.5.5,0,0,1,1,0v5.5H18A.5.5,0,0,1,18,12.5Z"
23
- />
24
- </g>
25
- </g>
26
- </svg>
27
- `,
28
- })
29
- export class CiClock2Component {
30
- class = input('');
31
- }
@@ -1,21 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
-
3
- // Icono inline extraído de react-icons/fa (FaArrowRight), espejo de
4
- // packages/vue/src/icons/FaArrowRight.vue (mismo `viewBox`/`d`).
5
- // Ver check-icon.component.ts para la explicación del enrutado de `class`.
6
- @Component({
7
- selector: 'ba-fa-arrow-right',
8
- standalone: true,
9
- changeDetection: ChangeDetectionStrategy.OnPush,
10
- host: { style: 'display: contents' },
11
- template: `
12
- <svg [class]="class()" viewBox="0 0 448 512" fill="currentColor" aria-hidden="true">
13
- <path
14
- d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"
15
- />
16
- </svg>
17
- `,
18
- })
19
- export class FaArrowRightComponent {
20
- class = input('');
21
- }
@@ -1,21 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
-
3
- // Icono inline extraído de react-icons/fa (FaTimes), espejo de
4
- // packages/vue/src/icons/FaTimes.vue (mismo `viewBox`/`d`).
5
- // Ver check-icon.component.ts para la explicación del enrutado de `class`.
6
- @Component({
7
- selector: 'ba-fa-times',
8
- standalone: true,
9
- changeDetection: ChangeDetectionStrategy.OnPush,
10
- host: { style: 'display: contents' },
11
- template: `
12
- <svg [class]="class()" viewBox="0 0 352 512" fill="currentColor" aria-hidden="true">
13
- <path
14
- d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
15
- />
16
- </svg>
17
- `,
18
- })
19
- export class FaTimesComponent {
20
- class = input('');
21
- }
@@ -1,21 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
-
3
- // Icono inline extraído de react-icons/fa (FaUndo), espejo de
4
- // packages/vue/src/icons/FaUndo.vue (mismo `viewBox`/`d`).
5
- // Ver check-icon.component.ts para la explicación del enrutado de `class`.
6
- @Component({
7
- selector: 'ba-fa-undo',
8
- standalone: true,
9
- changeDetection: ChangeDetectionStrategy.OnPush,
10
- host: { style: 'display: contents' },
11
- template: `
12
- <svg [class]="class()" viewBox="0 0 512 512" fill="currentColor" aria-hidden="true">
13
- <path
14
- d="M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z"
15
- />
16
- </svg>
17
- `,
18
- })
19
- export class FaUndoComponent {
20
- class = input('');
21
- }
@@ -1,25 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { render } from '@testing-library/angular';
3
- import type { Type } from '@angular/core';
4
- import * as icons from './index';
5
-
6
- // Espejo de packages/vue/src/icons/icons.test.ts: cada icono debe renderizar
7
- // un <svg> con `viewBox` y al menos un <path> con `d`. El host de cada
8
- // componente usa `display: contents` (ver check-icon.component.ts), así que
9
- // se consulta el `<svg>` dentro del `container`, no el host.
10
- describe('icons', () => {
11
- it.each(Object.entries(icons))(
12
- '%s renderiza un <svg> con viewBox y al menos un <path>',
13
- async (_name, IconComponent) => {
14
- const { container } = await render(IconComponent as Type<unknown>);
15
- const svg = container.querySelector('svg');
16
- expect(svg).not.toBeNull();
17
- expect(svg?.getAttribute('viewBox')).toBeTruthy();
18
- const paths = container.querySelectorAll('path');
19
- expect(paths.length).toBeGreaterThan(0);
20
- paths.forEach((path) => {
21
- expect(path.getAttribute('d')).toBeTruthy();
22
- });
23
- },
24
- );
25
- });
@@ -1,22 +0,0 @@
1
- // Barrel de iconos inline (Task A6). Cada componente reproduce fielmente el
2
- // SVG del icono de react-icons/heroicons homónimo (mismo nombre de export),
3
- // espejo 1:1 de packages/vue/src/icons/*.vue (mismo `viewBox`/`d`/`stroke`)
4
- // para que un futuro `grep` sobre el nombre original siga encontrando el
5
- // equivalente Angular sin fricción de traducción. Exports alfabetizados.
6
- export { AiOutlineDisconnectComponent } from './ai-outline-disconnect.component';
7
- export { BiLogoGmailComponent } from './bi-logo-gmail.component';
8
- export { CgProfileComponent } from './cg-profile.component';
9
- export { CheckIconComponent } from './check-icon.component';
10
- export { CiClock2Component } from './ci-clock2.component';
11
- export { FaArrowRightComponent } from './fa-arrow-right.component';
12
- export { FaTimesComponent } from './fa-times.component';
13
- export { FaUndoComponent } from './fa-undo.component';
14
- export { IoIosArrowBackComponent } from './io-ios-arrow-back.component';
15
- export { IoIosArrowForwardComponent } from './io-ios-arrow-forward.component';
16
- export { IoMdArrowBackComponent } from './io-md-arrow-back.component';
17
- export { IoMdArrowForwardComponent } from './io-md-arrow-forward.component';
18
- export { PiWarningFillComponent } from './pi-warning-fill.component';
19
- export { TbArrowsExchange2Component } from './tb-arrows-exchange2.component';
20
- export { TbCopyComponent } from './tb-copy.component';
21
- export { TbCopyCheckFilledComponent } from './tb-copy-check-filled.component';
22
- export { TiVendorMicrosoftComponent } from './ti-vendor-microsoft.component';