@block-auth.io/angular 0.4.0 → 0.5.0

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 +9976 -0
  2. package/fesm2022/block-auth.io-angular.mjs.map +1 -0
  3. package/index.d.ts +1155 -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 -1400
  8. package/.turbo/turbo-typecheck.log +0 -19
  9. package/CHANGELOG.md +0 -273
  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 -36
  16. package/src/lib/components/btns/btn-base-provider.component.ts +0 -61
  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 -222
  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 -172
  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 -95
  47. package/src/lib/components/flow-block-auth.component.ts +0 -228
  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 -280
  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 -119
  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 -700
  75. package/src/lib/components/txns/internals/solicited-data-modal.component.ts +0 -430
  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 -593
  81. package/src/lib/components/txns/internals/txn.component.ts +0 -453
  82. package/src/lib/components/txns/txns-overview.component.test.ts +0 -421
  83. package/src/lib/components/txns/txns-overview.component.ts +0 -461
  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 -20
  119. package/src/lib/primitives/horizontal-loader.component.ts +0 -46
  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 -22
  123. package/src/lib/primitives/img-loader.component.ts +0 -121
  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 -17
  130. package/src/lib/primitives/oval-spinner.component.ts +0 -136
  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 -34
  137. package/src/lib/primitives/progressbar.component.ts +0 -36
  138. package/src/lib/primitives/providersStyles.ts +0 -218
  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 -19
  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,461 +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]="
90
- 'bas-relative bas-box-border bas-flex bas-h-full bas-w-full bas-flex-col bas-font-medium ' +
91
- (hasHeader() ? '' : 'bas-items-center bas-justify-center bas-gap-6 bas-p-6')
92
- "
93
- >
94
- @if (isEmpty() && isSigning() && !isOtpRequired()) {
95
- <ba-txn-error
96
- [errorMessageTxt]="t('noTransactionsFound')"
97
- errorMessageSlug="no_transactions_found"
98
- [closeTxns]="closeTxns()"
99
- [isCountdown]="false"
100
- />
101
- } @else if (!isEmpty() && error().value) {
102
- <ba-txn-error
103
- [errorMessageTxt]="errorText()"
104
- [errorMessageSlug]="error().messageSlug"
105
- [closeTxns]="closeTxns()"
106
- [isCountdown]="false"
107
- />
108
- } @else if (!isEmpty() || isOtpRequired()) {
109
- <!-- No txn yet when the session expired before it was created. -->
110
- @if (hasHeader()) {
111
- <header
112
- class="bal-ba-glass-card-header bas-box-border bas-flex bas-w-full bas-shrink-0 bas-justify-center bas-px-6 bas-pb-9 bas-pt-5"
113
- >
114
- <div
115
- class="bal-ba-glass-rise bas-flex bas-flex-col bas-items-center bas-gap-2"
116
- >
117
- <img
118
- [src]="
119
- preParams().iconUrl ||
120
- 'https://dashboard.block-auth.io/img/blockauth_logo.png'
121
- "
122
- class="bal-ba-glass-logo bas-h-16"
123
- alt="app logo"
124
- />
125
- <h2 class="bas-m-0 bas-text-base bas-text-[var(--bal-primary-600)]">
126
- {{ preParams().domain || 'dashboard.block-auth.io' }}
127
- </h2>
128
- <p class="bas-m-0 bas-text-lg bas-text-[var(--bal-primary-800)]">
129
- {{ preParams().appName || 'Block-Auth' }}
130
- <span class="bas-text-base bas-text-[var(--bal-primary-500)]">{{
131
- t('solicitsTo')
132
- }}</span>
133
- {{ accountShort(did()) }}
134
- </p>
135
- </div>
136
- </header>
137
- }
138
- <div
139
- [class]="
140
- hasHeader()
141
- ? 'bal-ba-glass-card-body -bas-mt-4 bas-box-border bas-flex bas-min-h-0 bas-w-full bas-flex-1 bas-flex-col bas-items-center bas-gap-5 bas-overflow-y-auto bal-ba-scroll-base bas-px-6 bas-pb-6 bas-pt-5'
142
- : 'bas-contents'
143
- "
144
- >
145
- @if (hasHeader()) {
146
- <ba-txn-type
147
- [txnType]="preParams().txnType || t('login')"
148
- [txnsLength]="txns().length"
149
- (prevTxnClicked)="onPrevTxnClicked()"
150
- (nextTxnClicked)="onNextTxnClicked()"
151
- />
152
- }
153
- <!-- The server refuses this page's accept while the OTP window is
154
- over: the code is entered in the extension, which approves. -->
155
- @if (isOtpRequired()) {
156
- <div
157
- class="bas-flex bas-w-full bas-max-w-[300px] bas-flex-col bas-items-center bas-gap-6 bas-text-center"
158
- >
159
- <span
160
- 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)]"
161
- >
162
- <ba-ci-clock2 class="bas-h-8 bas-w-8 bas-text-[var(--bal-primary-600)]" />
163
- </span>
164
- <div class="bas-flex bas-flex-col bas-gap-2">
165
- <h3 class="bas-m-0 bas-text-lg bas-font-semibold bas-text-[var(--bal-primary-900)]">
166
- {{ t('otpExpiredTitle') }}
167
- </h3>
168
- <p class="bas-m-0 bas-text-sm bas-leading-relaxed bas-text-[#475569]">
169
- {{ t(ext().installed ? 'otpExpiredExtension' : 'otpExpiredApp') }}
170
- </p>
171
- </div>
172
- @if (ext().installed) {
173
- <button
174
- type="button"
175
- id="btn-txn-open-extension"
176
- (click)="openExtensionOnTxn()"
177
- 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)]"
178
- >
179
- {{ t('openExtension') }}
180
- <ba-fa-arrow-right class="bas-h-4 bas-w-4" />
181
- </button>
182
- }
183
- </div>
184
- } @else {
185
- <div class="bas-flex bas-w-full bas-max-w-[330px] bas-flex-1">
186
- <ba-txn
187
- class="bas-w-full"
188
- [hasSolicitedData]="hasSolicitedData()"
189
- [allRequiredFilled]="allRequiredFilled()"
190
- [solicitedDataPending]="solicitedDataPending()"
191
- [closeTxns]="closeTxns()"
192
- [selectedTxnPreParams]="preParams()"
193
- [userParamValues]="acceptParams().userParams"
194
- [grantedParams]="acceptParams().grantedParams"
195
- [revokedParams]="acceptParams().revokedParams"
196
- [addError]="addError"
197
- (permissionsRequiredClicked)="showPermissions.set(true)"
198
- (solicitedDataClicked)="openSolicitedData()"
199
- />
200
- </div>
201
- }
202
- </div>
203
- } @if (showPermissions()) {
204
- <div
205
- 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"
206
- (click)="showPermissions.set(false)"
207
- ></div>
208
- <div
209
- class="bas-pointer-events-none bas-absolute bas-inset-x-0 bas-top-44 bas-z-40 bas-box-border bas-flex bas-justify-center bas-px-4"
210
- >
211
- <div class="bas-pointer-events-auto bas-w-full bas-max-w-[334px]">
212
- <ba-permissions-required-modal />
213
- </div>
214
- </div>
215
- } @if (showSolicitedData()) {
216
- <div
217
- 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"
218
- (click)="cancelSolicitedData()"
219
- ></div>
220
- <ba-solicited-data-modal
221
- class="bal-ba-glass-modal-slot bas-absolute bas-inset-x-0 bas-inset-y-6 bas-z-40 bas-box-border bas-flex bas-justify-center bas-px-4"
222
- [requiredParams]="requiredParams()"
223
- [optionalParams]="optionalParams()"
224
- [params]="txnData()?.params"
225
- [userParamValues]="solicitedForm().values"
226
- [sharedParams]="solicitedForm().shared"
227
- [savedParams]="solicitedForm().saved"
228
- [errorTxt]="acceptTxnError() ? t('requiredDataError') : undefined"
229
- [closable]="true"
230
- [acceptable]="true"
231
- (paramChange)="handleParamChange($event)"
232
- (shareChange)="handleShareChange($event)"
233
- (saveParam)="handleSaveParam($event)"
234
- (undoParam)="handleUndoParam($event)"
235
- (closed)="cancelSolicitedData()"
236
- (accepted)="showSolicitedData.set(false)"
237
- />
238
- }
239
- </div>
240
- `,
241
- })
242
- export class TxnsOverviewComponent {
243
- closeTxns = input<() => void>(() => {});
244
-
245
- private readonly client = injectBlockAuthClient();
246
- private readonly ws = injectStore(this.client.state.$ws);
247
- private readonly ui = injectStore(this.client.state.$ui);
248
- protected readonly ext = injectStore($extension);
249
- private readonly locale = injectStore($locale);
250
- protected t = (key: TextKey): string => translate(key, this.locale());
251
-
252
- protected readonly accountShort = accountShort;
253
-
254
- protected readonly selectedIndex = signal(0);
255
- protected readonly showPermissions = signal(false);
256
- protected readonly showSolicitedData = signal(false);
257
- protected readonly solicitedForm = signal<SolicitedDataForm>(
258
- EMPTY_SOLICITED_DATA_FORM,
259
- );
260
- private solicitedSnapshot: SolicitedDataForm = EMPTY_SOLICITED_DATA_FORM;
261
- protected readonly txnData = signal<TxnDataRequest | null>(null);
262
- private readonly isLoadingTxnData = signal(false);
263
- private readonly txnDataReload = signal(0);
264
- protected readonly error = signal<{ value: boolean; messageSlug: string }>({
265
- value: false,
266
- messageSlug: '',
267
- });
268
-
269
- protected readonly txns = computed(() => this.ws().requests ?? []);
270
- protected readonly did = computed(() => this.ws().did);
271
- protected readonly isSigning = computed(() => this.ui().isSigning);
272
- protected readonly isOtpRequired = computed(() => this.ui().isOtpRequired);
273
- protected readonly acceptTxnError = computed(() => this.ui().acceptTxnError);
274
- protected readonly openExtensionOnTxn = openExtensionOnTxn;
275
- protected readonly isEmpty = computed(() => this.txns().length === 0);
276
- protected readonly hasHeader = computed(
277
- () => !this.isEmpty() && !this.error().value,
278
- );
279
- protected readonly errorText = computed(() =>
280
- this.t(
281
- TXN_ERROR_TEXT_KEYS[this.error().messageSlug] ??
282
- TXN_ERROR_TEXT_KEYS['unknown'],
283
- ),
284
- );
285
-
286
- private readonly selectedTxn = computed(
287
- () => this.txns()[this.selectedIndex()] ?? this.txns()[0],
288
- );
289
- protected readonly preParams = computed<TxnPreParams>(() => {
290
- const raw = this.selectedTxn()?.['pre_params'] as string | undefined;
291
- if (!raw) return {};
292
- try {
293
- return JSON.parse(raw) as TxnPreParams;
294
- } catch {
295
- return {};
296
- }
297
- });
298
-
299
- private readonly requiredOptionalParams = computed(() => {
300
- const cfg =
301
- (this.ui().uiConfig as { config?: Record<string, unknown> } | null)
302
- ?.config ?? {};
303
- const required: string[] = [];
304
- const optional: string[] = [];
305
- const kycMode = (cfg['modules'] as { kyc?: { mode?: string } } | undefined)
306
- ?.kyc?.mode;
307
- if (kycMode === 'required') required.push('modules-kyc');
308
- else if (kycMode === 'optional') optional.push('modules-kyc');
309
- Object.entries(
310
- (cfg['params'] as Record<string, { mode?: string }>) || {},
311
- ).forEach(([slug, paramCfg]) => {
312
- if (paramCfg.mode === 'required') required.push(slug);
313
- else if (paramCfg.mode === 'optional') optional.push(slug);
314
- });
315
- return { requiredParams: required, optionalParams: optional };
316
- });
317
- protected readonly requiredParams = computed(
318
- () => this.requiredOptionalParams().requiredParams,
319
- );
320
- protected readonly optionalParams = computed(
321
- () => this.requiredOptionalParams().optionalParams,
322
- );
323
- private readonly selectedTxnId = computed(
324
- () => this.selectedTxn()?.['id'] as number | string | undefined,
325
- );
326
- private readonly solicitedParams = computed(() =>
327
- getSolicitedParams({
328
- params: this.txnData()?.params,
329
- requiredParams: this.requiredParams(),
330
- optionalParams: this.optionalParams(),
331
- }),
332
- );
333
- protected readonly hasSolicitedData = computed(() =>
334
- this.txnData()
335
- ? this.solicitedParams().length > 0
336
- : this.requiredParams().length > 0 || this.optionalParams().length > 0,
337
- );
338
- private readonly solicitedFields = computed(() =>
339
- getSolicitedFields(
340
- this.solicitedParams(),
341
- this.solicitedForm(),
342
- !!this.txnData(),
343
- ),
344
- );
345
- private readonly isSolicitedComplete = computed(() =>
346
- isSolicitedDataComplete(this.solicitedFields()),
347
- );
348
- protected readonly allRequiredFilled = computed(
349
- () =>
350
- (!this.isLoadingTxnData() || this.solicitedParams().length === 0) &&
351
- this.isSolicitedComplete(),
352
- );
353
- protected readonly solicitedDataPending = computed(
354
- () =>
355
- this.hasSolicitedData() &&
356
- !this.isLoadingTxnData() &&
357
- !this.isSolicitedComplete(),
358
- );
359
- protected readonly acceptParams = computed(() =>
360
- getSolicitedAcceptParams(this.solicitedFields()),
361
- );
362
-
363
- constructor() {
364
- effect((onCleanup) => {
365
- const txnId = this.selectedTxnId();
366
- this.txnDataReload();
367
- untracked(() => {
368
- this.txnData.set(null);
369
- if (txnId == null) {
370
- this.isLoadingTxnData.set(false);
371
- return;
372
- }
373
- let active = true;
374
- this.isLoadingTxnData.set(true);
375
- Promise.resolve()
376
- .then(() => this.client.txns.dataRequest(txnId))
377
- .catch(() => null)
378
- .then((result) => {
379
- if (!active) return;
380
- this.txnData.set(result ?? null);
381
- this.isLoadingTxnData.set(false);
382
- });
383
- onCleanup(() => {
384
- active = false;
385
- });
386
- });
387
- });
388
-
389
- effect(() => {
390
- if (!this.acceptTxnError()) return;
391
- untracked(() => {
392
- this.openSolicitedData();
393
- this.txnDataReload.update((n) => n + 1);
394
- });
395
- });
396
-
397
- effect(() => {
398
- this.selectedTxnId();
399
- untracked(() => {
400
- this.solicitedForm.set(EMPTY_SOLICITED_DATA_FORM);
401
- this.client.state.$ui.setKey('acceptTxnError', null);
402
- });
403
- });
404
- }
405
-
406
- // Surfaces an accept-validation error and clears the accepting loader.
407
- addError = (messageSlug = 'unknown'): void => {
408
- this.error.set({ value: true, messageSlug });
409
- this.client.state.$ui.setKey('isAcceptingTxn', false);
410
- };
411
-
412
- private updateParam(
413
- slug: string,
414
- update: (
415
- form: SolicitedDataForm,
416
- item: SolicitedParam,
417
- ) => SolicitedDataForm,
418
- ): void {
419
- const item = this.solicitedParams().find((param) => param.slug === slug);
420
- if (item) this.solicitedForm.update((prev) => update(prev, item));
421
- }
422
-
423
- handleParamChange({ slug, value }: ParamChange): void {
424
- this.updateParam(slug, (form, item) =>
425
- setSolicitedValue(form, item, value),
426
- );
427
- }
428
-
429
- handleShareChange({ slug, shared }: ShareChange): void {
430
- this.solicitedForm.update((prev) => setSolicitedShared(prev, slug, shared));
431
- }
432
-
433
- handleSaveParam(slug: string): void {
434
- this.solicitedForm.update((prev) => saveSolicitedValue(prev, slug));
435
- }
436
-
437
- handleUndoParam(slug: string): void {
438
- this.updateParam(slug, undoSolicitedValue);
439
- }
440
-
441
- openSolicitedData(): void {
442
- this.solicitedSnapshot = this.solicitedForm();
443
- this.showSolicitedData.set(true);
444
- }
445
-
446
- cancelSolicitedData(): void {
447
- this.solicitedForm.set(this.solicitedSnapshot);
448
- this.showSolicitedData.set(false);
449
- }
450
-
451
- onPrevTxnClicked(): void {
452
- const len = this.txns().length;
453
- if (len === 0) return;
454
- this.selectedIndex.update((i) => (i === 0 ? len - 1 : i - 1));
455
- }
456
- onNextTxnClicked(): void {
457
- const len = this.txns().length;
458
- if (len === 0) return;
459
- this.selectedIndex.update((i) => (i === len - 1 ? 0 : i + 1));
460
- }
461
- }
@@ -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
- }