@block-auth.io/angular 0.1.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.
- package/.turbo/turbo-build.log +37 -0
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +82 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +10 -0
- package/ng-package.json +6 -0
- package/package.json +50 -0
- package/scripts/css-to-ts.mjs +14 -0
- package/src/lib/__tests__/integration.test.ts +45 -0
- package/src/lib/block-auth.service.test.ts +69 -0
- package/src/lib/block-auth.service.ts +81 -0
- package/src/lib/components/btns/btn-base-provider.component.test.ts +22 -0
- package/src/lib/components/btns/btn-base-provider.component.ts +55 -0
- package/src/lib/components/btns/btn-block-auth.component.test.ts +79 -0
- package/src/lib/components/btns/btn-block-auth.component.ts +104 -0
- package/src/lib/components/btns/btn-gmail.component.test.ts +16 -0
- package/src/lib/components/btns/btn-gmail.component.ts +41 -0
- package/src/lib/components/btns/btn-google-base.component.test.ts +16 -0
- package/src/lib/components/btns/btn-google-base.component.ts +73 -0
- package/src/lib/components/btns/btn-metamask.component.test.ts +20 -0
- package/src/lib/components/btns/btn-metamask.component.ts +98 -0
- package/src/lib/components/btns/btn-microsoft.component.test.ts +16 -0
- package/src/lib/components/btns/btn-microsoft.component.ts +77 -0
- package/src/lib/components/btns/btn-phantom.component.test.ts +20 -0
- package/src/lib/components/btns/btn-phantom.component.ts +93 -0
- package/src/lib/components/btns/btn-signin.component.test.ts +55 -0
- package/src/lib/components/btns/btn-signin.component.ts +108 -0
- package/src/lib/components/btns/btn-wallet-connect.component.test.ts +20 -0
- package/src/lib/components/btns/btn-wallet-connect.component.ts +109 -0
- package/src/lib/components/btns/index.ts +11 -0
- package/src/lib/components/contents/content-signin.component.test.ts +33 -0
- package/src/lib/components/contents/content-signin.component.ts +68 -0
- package/src/lib/components/contents/content-signup.component.test.ts +78 -0
- package/src/lib/components/contents/content-signup.component.ts +225 -0
- package/src/lib/components/dds/change-account.component.test.ts +66 -0
- package/src/lib/components/dds/change-account.component.ts +112 -0
- package/src/lib/components/dds/dropdown-profile-btn.component.test.ts +66 -0
- package/src/lib/components/dds/dropdown-profile-btn.component.ts +185 -0
- package/src/lib/components/dds/dropdown-profile-item.component.test.ts +75 -0
- package/src/lib/components/dds/dropdown-profile-item.component.ts +74 -0
- package/src/lib/components/dds/dropdown-profile.component.test.ts +98 -0
- package/src/lib/components/dds/dropdown-profile.component.ts +258 -0
- package/src/lib/components/flow-block-auth.component.test.ts +93 -0
- package/src/lib/components/flow-block-auth.component.ts +226 -0
- package/src/lib/components/modals/modal-overlay.component.test.ts +81 -0
- package/src/lib/components/modals/modal-overlay.component.ts +43 -0
- package/src/lib/components/modals/modal-restoration-expired.component.test.ts +71 -0
- package/src/lib/components/modals/modal-restoration-expired.component.ts +83 -0
- package/src/lib/components/modals/modal-restore.component.test.ts +74 -0
- package/src/lib/components/modals/modal-restore.component.ts +104 -0
- package/src/lib/components/modals/modal-signin.component.test.ts +66 -0
- package/src/lib/components/modals/modal-signin.component.ts +44 -0
- package/src/lib/components/modals/modal-signup.component.test.ts +56 -0
- package/src/lib/components/modals/modal-signup.component.ts +40 -0
- package/src/lib/components/sections/footer-section.component.test.ts +19 -0
- package/src/lib/components/sections/footer-section.component.ts +49 -0
- package/src/lib/components/sections/internals/providers-buttons.component.test.ts +27 -0
- package/src/lib/components/sections/internals/providers-buttons.component.ts +290 -0
- package/src/lib/components/sections/internals/providers-filters.component.test.ts +25 -0
- package/src/lib/components/sections/internals/providers-filters.component.ts +139 -0
- package/src/lib/components/sections/internals/selected-button.component.test.ts +36 -0
- package/src/lib/components/sections/internals/selected-button.component.ts +92 -0
- package/src/lib/components/sections/login-section.component.test.ts +49 -0
- package/src/lib/components/sections/login-section.component.ts +120 -0
- package/src/lib/components/sections/providers-section.component.test.ts +22 -0
- package/src/lib/components/sections/providers-section.component.ts +187 -0
- package/src/lib/components/txns/internals/permissions-required-modal.component.test.ts +14 -0
- package/src/lib/components/txns/internals/permissions-required-modal.component.ts +35 -0
- package/src/lib/components/txns/internals/solicited-data-modal.component.test.ts +72 -0
- package/src/lib/components/txns/internals/solicited-data-modal.component.ts +187 -0
- package/src/lib/components/txns/internals/txn-error.component.test.ts +100 -0
- package/src/lib/components/txns/internals/txn-error.component.ts +121 -0
- package/src/lib/components/txns/internals/txn-type.component.test.ts +52 -0
- package/src/lib/components/txns/internals/txn-type.component.ts +51 -0
- package/src/lib/components/txns/internals/txn.component.test.ts +188 -0
- package/src/lib/components/txns/internals/txn.component.ts +298 -0
- package/src/lib/components/txns/txns-overview.component.test.ts +107 -0
- package/src/lib/components/txns/txns-overview.component.ts +229 -0
- package/src/lib/icons/ai-outline-disconnect.component.ts +21 -0
- package/src/lib/icons/bi-logo-gmail.component.ts +21 -0
- package/src/lib/icons/cg-profile.component.ts +31 -0
- package/src/lib/icons/check-icon.component.ts +27 -0
- package/src/lib/icons/ci-clock2.component.ts +31 -0
- package/src/lib/icons/fa-arrow-right.component.ts +21 -0
- package/src/lib/icons/fa-times.component.ts +21 -0
- package/src/lib/icons/fa-undo.component.ts +21 -0
- package/src/lib/icons/icons.test.ts +25 -0
- package/src/lib/icons/index.ts +22 -0
- package/src/lib/icons/io-ios-arrow-back.component.ts +21 -0
- package/src/lib/icons/io-ios-arrow-forward.component.ts +21 -0
- package/src/lib/icons/io-md-arrow-back.component.ts +19 -0
- package/src/lib/icons/io-md-arrow-forward.component.ts +19 -0
- package/src/lib/icons/pi-warning-fill.component.ts +21 -0
- package/src/lib/icons/tb-arrows-exchange2.component.ts +30 -0
- package/src/lib/icons/tb-copy-check-filled.component.ts +21 -0
- package/src/lib/icons/tb-copy.component.ts +34 -0
- package/src/lib/icons/ti-vendor-microsoft.component.ts +21 -0
- package/src/lib/inject-store.test.ts +26 -0
- package/src/lib/inject-store.ts +16 -0
- package/src/lib/primitives/arrow-icon.component.test.ts +12 -0
- package/src/lib/primitives/arrow-icon.component.ts +38 -0
- package/src/lib/primitives/btn-arrow-dir.component.test.ts +22 -0
- package/src/lib/primitives/btn-arrow-dir.component.ts +65 -0
- package/src/lib/primitives/btn-base.component.test.ts +38 -0
- package/src/lib/primitives/btn-base.component.ts +140 -0
- package/src/lib/primitives/divider-base.component.test.ts +12 -0
- package/src/lib/primitives/divider-base.component.ts +74 -0
- package/src/lib/primitives/dropdown-arrow.component.test.ts +12 -0
- package/src/lib/primitives/dropdown-arrow.component.ts +46 -0
- package/src/lib/primitives/dropdown-base.component.test.ts +49 -0
- package/src/lib/primitives/dropdown-base.component.ts +329 -0
- package/src/lib/primitives/helpers.ts +151 -0
- package/src/lib/primitives/horizontal-loader.component.test.ts +19 -0
- package/src/lib/primitives/horizontal-loader.component.ts +70 -0
- package/src/lib/primitives/icon-base.component.test.ts +19 -0
- package/src/lib/primitives/icon-base.component.ts +58 -0
- package/src/lib/primitives/img-loader.component.test.ts +12 -0
- package/src/lib/primitives/img-loader.component.ts +118 -0
- package/src/lib/primitives/index.ts +29 -0
- package/src/lib/primitives/input-base.component.test.ts +20 -0
- package/src/lib/primitives/input-base.component.ts +210 -0
- package/src/lib/primitives/lifetime-slider-base.component.test.ts +88 -0
- package/src/lib/primitives/lifetime-slider-base.component.ts +75 -0
- package/src/lib/primitives/oval-spinner.component.test.ts +9 -0
- package/src/lib/primitives/oval-spinner.component.ts +158 -0
- package/src/lib/primitives/pickers/dropdown-picker-animated-base.component.ts +220 -0
- package/src/lib/primitives/pickers/picker-button.component.ts +74 -0
- package/src/lib/primitives/pickers/time-picker-dropdown-selector.component.ts +188 -0
- package/src/lib/primitives/pickers/time-picker.component.ts +124 -0
- package/src/lib/primitives/pickers/time-unit-selector.component.ts +82 -0
- package/src/lib/primitives/progressbar.component.test.ts +18 -0
- package/src/lib/primitives/progressbar.component.ts +93 -0
- package/src/lib/primitives/providersStyles.ts +268 -0
- package/src/lib/primitives/slider-base.component.ts +56 -0
- package/src/lib/provide-block-auth.test.ts +43 -0
- package/src/lib/provide-block-auth.ts +43 -0
- package/src/lib/runtime/block-auth-runtime.directive.test.ts +89 -0
- package/src/lib/runtime/block-auth-runtime.directive.ts +68 -0
- package/src/lib/teleport-body.directive.test.ts +29 -0
- package/src/lib/teleport-body.directive.ts +21 -0
- package/src/lib/testing.ts +15 -0
- package/src/lib/transitions.css +23 -0
- package/src/public-api.ts +85 -0
- package/src/vitest.setup.ts +8 -0
- package/tailwind.config.cjs +6 -0
- package/tsconfig.json +15 -0
- package/tsconfig.lib.json +9 -0
- package/vite.config.mts +44 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
> @block-auth.io/angular@0.1.0 build /home/wenqi/Documents/blockauthio/blockauth-sdk/packages/angular
|
|
3
|
+
> pnpm build:css && ng-packagr -p ng-package.json -c tsconfig.lib.json
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> @block-auth.io/angular@0.1.0 build:css /home/wenqi/Documents/blockauthio/blockauth-sdk/packages/angular
|
|
7
|
+
> tailwindcss -i ../ui-styles/src/input.css -c ./tailwind.config.cjs -o ./src/styles.generated.css --minify && node scripts/css-to-ts.mjs
|
|
8
|
+
|
|
9
|
+
Browserslist: caniuse-lite is outdated. Please run:
|
|
10
|
+
npx update-browserslist-db@latest
|
|
11
|
+
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
12
|
+
|
|
13
|
+
Rebuilding...
|
|
14
|
+
|
|
15
|
+
Done in 642ms.
|
|
16
|
+
[34mBuilding Angular Package[39m
|
|
17
|
+
[37m[39m
|
|
18
|
+
[37m------------------------------------------------------------------------------[39m
|
|
19
|
+
[37mBuilding entry point '@block-auth.io/angular'[39m
|
|
20
|
+
[37m------------------------------------------------------------------------------[39m
|
|
21
|
+
[1G[1G[36m⠋[39m Compiling with Angular sources in partial compilation mode.[1G[0K[36m⠙[39m Compiling with Angular sources in partial compilation mode.
|
|
22
|
+
[1G[0K[32m✔[39m Compiling with Angular sources in partial compilation mode.
|
|
23
|
+
[1G[1G[36m⠋[39m Writing FESM and DTS bundles[1G[0K[32m✔[39m Writing FESM and DTS bundles
|
|
24
|
+
[1G[1G[36m⠋[39m Copying assets[1G[0K[32m✔[39m Copying assets
|
|
25
|
+
[1G[36m⠋[39m Writing package manifest[1G[0K[34mℹ[39m Removing scripts section in package.json as it's considered a potential security vulnerability.
|
|
26
|
+
[1G[34mℹ[39m Removing devDependencies section in package.json.
|
|
27
|
+
[1G[32m✔[39m Writing package manifest
|
|
28
|
+
[1G[32m✔[39m Built @block-auth.io/angular
|
|
29
|
+
[32m[39m
|
|
30
|
+
[32m------------------------------------------------------------------------------[39m
|
|
31
|
+
[32mBuilt Angular Package[39m
|
|
32
|
+
[32m- from: /home/wenqi/Documents/blockauthio/blockauth-sdk/packages/angular[39m
|
|
33
|
+
[32m- to: /home/wenqi/Documents/blockauthio/blockauth-sdk/packages/angular/dist[39m
|
|
34
|
+
[32m------------------------------------------------------------------------------[39m
|
|
35
|
+
[37m[37m[39m[37m[39m
|
|
36
|
+
[37m[37mBuild at: [1m2026-07-20T10:48:30.441Z[22m - Time: [1m2293[22mms[39m[37m[39m
|
|
37
|
+
[37m[37m[39m[37m[39m
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
> @block-auth.io/angular@0.1.0 pretest /home/wenqi/Documents/blockauthio/blockauth-sdk/packages/angular
|
|
3
|
+
> pnpm build:css
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> @block-auth.io/angular@0.1.0 build:css /home/wenqi/Documents/blockauthio/blockauth-sdk/packages/angular
|
|
7
|
+
> tailwindcss -i ../ui-styles/src/input.css -c ./tailwind.config.cjs -o ./src/styles.generated.css --minify && node scripts/css-to-ts.mjs
|
|
8
|
+
|
|
9
|
+
Browserslist: caniuse-lite is outdated. Please run:
|
|
10
|
+
npx update-browserslist-db@latest
|
|
11
|
+
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
12
|
+
|
|
13
|
+
Rebuilding...
|
|
14
|
+
|
|
15
|
+
Done in 1931ms.
|
|
16
|
+
|
|
17
|
+
> @block-auth.io/angular@0.1.0 test /home/wenqi/Documents/blockauthio/blockauth-sdk/packages/angular
|
|
18
|
+
> vitest run
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
RUN v3.2.7 /home/wenqi/Documents/blockauthio/blockauth-sdk/packages/angular
|
|
22
|
+
|
|
23
|
+
✓ src/lib/components/dds/dropdown-profile-item.component.test.ts (5 tests) 123ms
|
|
24
|
+
✓ src/lib/components/txns/internals/solicited-data-modal.component.test.ts (3 tests) 159ms
|
|
25
|
+
✓ src/lib/components/modals/modal-overlay.component.test.ts (4 tests) 179ms
|
|
26
|
+
✓ src/lib/primitives/dropdown-base.component.test.ts (4 tests) 292ms
|
|
27
|
+
✓ src/lib/components/txns/internals/txn-type.component.test.ts (3 tests) 113ms
|
|
28
|
+
✓ src/lib/primitives/btn-base.component.test.ts (3 tests) 131ms
|
|
29
|
+
✓ src/lib/block-auth.service.test.ts (2 tests) 135ms
|
|
30
|
+
✓ src/lib/components/txns/internals/txn-error.component.test.ts (4 tests) 147ms
|
|
31
|
+
✓ src/lib/components/dds/dropdown-profile-btn.component.test.ts (2 tests) 163ms
|
|
32
|
+
✓ src/lib/components/modals/modal-signin.component.test.ts (3 tests) 141ms
|
|
33
|
+
✓ src/lib/components/modals/modal-restore.component.test.ts (4 tests) 289ms
|
|
34
|
+
✓ src/lib/components/modals/modal-restoration-expired.component.test.ts (4 tests) 255ms
|
|
35
|
+
✓ src/lib/components/dds/change-account.component.test.ts (8 tests) 264ms
|
|
36
|
+
✓ src/lib/components/txns/txns-overview.component.test.ts (6 tests) 302ms
|
|
37
|
+
✓ src/lib/components/dds/dropdown-profile.component.test.ts (5 tests) 337ms
|
|
38
|
+
✓ src/lib/components/contents/content-signup.component.test.ts (3 tests) 344ms
|
|
39
|
+
✓ src/lib/components/sections/login-section.component.test.ts (2 tests) 203ms
|
|
40
|
+
✓ src/lib/components/modals/modal-signup.component.test.ts (3 tests) 399ms
|
|
41
|
+
✓ src/lib/runtime/block-auth-runtime.directive.test.ts (4 tests) 124ms
|
|
42
|
+
✓ src/lib/components/flow-block-auth.component.test.ts (3 tests) 444ms
|
|
43
|
+
✓ src/lib/components/txns/internals/txn.component.test.ts (10 tests) 716ms
|
|
44
|
+
✓ src/lib/components/btns/btn-block-auth.component.test.ts (4 tests) 288ms
|
|
45
|
+
✓ src/lib/components/btns/btn-signin.component.test.ts (4 tests) 278ms
|
|
46
|
+
✓ src/lib/primitives/btn-arrow-dir.component.test.ts (2 tests) 102ms
|
|
47
|
+
✓ src/lib/__tests__/integration.test.ts (1 test) 566ms
|
|
48
|
+
✓ integración Angular + core > conectar wallet propaga la address al estado consumido por Angular 564ms
|
|
49
|
+
✓ src/lib/primitives/horizontal-loader.component.test.ts (2 tests) 117ms
|
|
50
|
+
✓ src/lib/primitives/lifetime-slider-base.component.test.ts (5 tests) 645ms
|
|
51
|
+
✓ src/lib/components/sections/internals/selected-button.component.test.ts (1 test) 131ms
|
|
52
|
+
✓ src/lib/teleport-body.directive.test.ts (2 tests) 141ms
|
|
53
|
+
✓ src/lib/primitives/input-base.component.test.ts (2 tests) 101ms
|
|
54
|
+
✓ src/lib/provide-block-auth.test.ts (3 tests) 128ms
|
|
55
|
+
✓ src/lib/primitives/icon-base.component.test.ts (2 tests) 82ms
|
|
56
|
+
✓ src/lib/icons/icons.test.ts (17 tests) 292ms
|
|
57
|
+
✓ src/lib/primitives/progressbar.component.test.ts (2 tests) 174ms
|
|
58
|
+
✓ src/lib/inject-store.test.ts (1 test) 56ms
|
|
59
|
+
✓ src/lib/components/btns/btn-base-provider.component.test.ts (1 test) 212ms
|
|
60
|
+
✓ src/lib/components/sections/footer-section.component.test.ts (1 test) 90ms
|
|
61
|
+
✓ src/lib/primitives/oval-spinner.component.test.ts (1 test) 71ms
|
|
62
|
+
✓ src/lib/primitives/img-loader.component.test.ts (1 test) 69ms
|
|
63
|
+
✓ src/lib/primitives/divider-base.component.test.ts (1 test) 60ms
|
|
64
|
+
✓ src/lib/primitives/dropdown-arrow.component.test.ts (1 test) 67ms
|
|
65
|
+
✓ src/lib/primitives/arrow-icon.component.test.ts (1 test) 53ms
|
|
66
|
+
✓ src/lib/components/txns/internals/permissions-required-modal.component.test.ts (1 test) 66ms
|
|
67
|
+
✓ src/lib/components/contents/content-signin.component.test.ts (2 tests) 65ms
|
|
68
|
+
✓ src/lib/components/sections/internals/providers-filters.component.test.ts (1 test) 93ms
|
|
69
|
+
✓ src/lib/components/sections/internals/providers-buttons.component.test.ts (1 test) 108ms
|
|
70
|
+
✓ src/lib/components/btns/btn-google-base.component.test.ts (1 test) 66ms
|
|
71
|
+
✓ src/lib/components/btns/btn-gmail.component.test.ts (1 test) 104ms
|
|
72
|
+
✓ src/lib/components/btns/btn-metamask.component.test.ts (1 test) 81ms
|
|
73
|
+
✓ src/lib/components/btns/btn-wallet-connect.component.test.ts (1 test) 84ms
|
|
74
|
+
✓ src/lib/components/btns/btn-phantom.component.test.ts (1 test) 93ms
|
|
75
|
+
✓ src/lib/components/sections/providers-section.component.test.ts (1 test) 124ms
|
|
76
|
+
✓ src/lib/components/btns/btn-microsoft.component.test.ts (1 test) 104ms
|
|
77
|
+
|
|
78
|
+
Test Files 53 passed (53)
|
|
79
|
+
Tests 152 passed (152)
|
|
80
|
+
Start at 13:00:23
|
|
81
|
+
Duration 8.03s (transform 9.20s, setup 34.06s, collect 64.46s, tests 9.97s, environment 20.36s, prepare 27.10s)
|
|
82
|
+
|
package/CHANGELOG.md
ADDED
package/ng-package.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@block-auth.io/angular",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build:css": "tailwindcss -i ../ui-styles/src/input.css -c ./tailwind.config.cjs -o ./src/styles.generated.css --minify && node scripts/css-to-ts.mjs",
|
|
6
|
+
"build": "pnpm build:css && ng-packagr -p ng-package.json -c tsconfig.lib.json",
|
|
7
|
+
"dev": "pnpm build:css && ng-packagr -p ng-package.json -c tsconfig.lib.json --watch",
|
|
8
|
+
"pretest": "pnpm build:css",
|
|
9
|
+
"test": "vitest run",
|
|
10
|
+
"pretypecheck": "pnpm build:css",
|
|
11
|
+
"typecheck": "tsc -p tsconfig.lib.json --noEmit",
|
|
12
|
+
"lint": "eslint src"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@block-auth.io/core": "workspace:*",
|
|
16
|
+
"@block-auth.io/ui-styles": "workspace:*",
|
|
17
|
+
"nanostores": "^0.10.0",
|
|
18
|
+
"tslib": "^2.6.0"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@angular/core": ">=20.0.0",
|
|
22
|
+
"@angular/common": ">=20.0.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@analogjs/vite-plugin-angular": "^2.6.0",
|
|
26
|
+
"@angular/build": "^20.3.0",
|
|
27
|
+
"@angular/common": "^20.3.0",
|
|
28
|
+
"@angular/compiler": "^20.3.0",
|
|
29
|
+
"@angular/compiler-cli": "^20.3.0",
|
|
30
|
+
"@angular/core": "^20.3.0",
|
|
31
|
+
"@angular/platform-browser": "^20.3.0",
|
|
32
|
+
"@angular/platform-browser-dynamic": "^20.3.0",
|
|
33
|
+
"@angular/router": "^20.3.0",
|
|
34
|
+
"@testing-library/angular": "^18.1.0",
|
|
35
|
+
"@testing-library/dom": "^10.0.0",
|
|
36
|
+
"@wagmi/connectors": "^8.0.0",
|
|
37
|
+
"@wagmi/core": "^3.5.0",
|
|
38
|
+
"jsdom": "^24.0.0",
|
|
39
|
+
"ng-packagr": "^20.3.0",
|
|
40
|
+
"rxjs": "^7.8.0",
|
|
41
|
+
"tailwindcss": "^3.4.0",
|
|
42
|
+
"typescript": "~5.8.0",
|
|
43
|
+
"vite": "^6.0.0",
|
|
44
|
+
"vitest": "^3.2.0",
|
|
45
|
+
"zone.js": "~0.15.0"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { resolve, dirname } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const generated = readFileSync(resolve(here, '../src/styles.generated.css'), 'utf8');
|
|
7
|
+
const libStyles = readFileSync(resolve(here, '../../ui-styles/src/lib-styles.css'), 'utf8');
|
|
8
|
+
const transitions = readFileSync(resolve(here, '../src/lib/transitions.css'), 'utf8');
|
|
9
|
+
|
|
10
|
+
const css = [generated, libStyles, transitions].join('\n');
|
|
11
|
+
writeFileSync(
|
|
12
|
+
resolve(here, '../src/styles.generated.ts'),
|
|
13
|
+
`// GENERADO por scripts/css-to-ts.mjs — no editar a mano.\nexport const BLOCKAUTH_CSS: string = ${JSON.stringify(css)};\n`,
|
|
14
|
+
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { Component, inject } from '@angular/core';
|
|
3
|
+
import { render, screen, fireEvent, waitFor } from '@testing-library/angular';
|
|
4
|
+
|
|
5
|
+
vi.mock('@wagmi/core', () => ({
|
|
6
|
+
createConfig: vi.fn(() => ({ connectors: [] })),
|
|
7
|
+
connect: vi.fn(async () => ({ accounts: ['0xabc'], chainId: 1 })),
|
|
8
|
+
disconnect: vi.fn(), getAccount: vi.fn(() => ({ address: '0xabc' })),
|
|
9
|
+
signMessage: vi.fn(async () => '0xsig'),
|
|
10
|
+
watchAccount: vi.fn(() => () => undefined), http: vi.fn(),
|
|
11
|
+
}));
|
|
12
|
+
vi.mock('@wagmi/connectors', () => ({
|
|
13
|
+
injected: vi.fn(() => ({ id: 'injected' })), walletConnect: vi.fn(() => ({ id: 'walletConnect' })),
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
import { provideBlockAuth } from '../provide-block-auth';
|
|
17
|
+
import { BlockAuthService } from '../block-auth.service';
|
|
18
|
+
import { BtnMetamaskComponent } from '../components/btns/btn-metamask.component';
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'ba-host',
|
|
22
|
+
standalone: true,
|
|
23
|
+
imports: [BtnMetamaskComponent],
|
|
24
|
+
template: `
|
|
25
|
+
<ba-btn-metamask />
|
|
26
|
+
<span data-testid="addr">{{ ba.wallet().address ?? 'none' }}</span>
|
|
27
|
+
`,
|
|
28
|
+
})
|
|
29
|
+
class HostComponent {
|
|
30
|
+
ba = inject(BlockAuthService);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe('integración Angular + core', () => {
|
|
34
|
+
it('conectar wallet propaga la address al estado consumido por Angular', async () => {
|
|
35
|
+
const { detectChanges } = await render(HostComponent, {
|
|
36
|
+
providers: [provideBlockAuth({ apiKey: 'k', apiSecret: 's', walletConnectProjectId: 'pid' })],
|
|
37
|
+
});
|
|
38
|
+
expect(screen.getByTestId('addr').textContent).toBe('none');
|
|
39
|
+
fireEvent.click(screen.getByRole('button'));
|
|
40
|
+
await waitFor(() => {
|
|
41
|
+
detectChanges();
|
|
42
|
+
expect(screen.getByTestId('addr').textContent).toBe('0xabc');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
+
import { Component, inject } from '@angular/core';
|
|
3
|
+
import { TestBed } from '@angular/core/testing';
|
|
4
|
+
import { render, screen } from '@testing-library/angular';
|
|
5
|
+
import { resetUi, resetWallet, resetUser, closeAllModals, setLocale } from '@block-auth.io/core';
|
|
6
|
+
|
|
7
|
+
vi.mock('@wagmi/core', () => ({
|
|
8
|
+
createConfig: vi.fn(() => ({ connectors: [] })),
|
|
9
|
+
connect: vi.fn(), disconnect: vi.fn(), getAccount: vi.fn(() => ({})),
|
|
10
|
+
signMessage: vi.fn(), watchAccount: vi.fn(() => () => undefined), http: vi.fn(),
|
|
11
|
+
}));
|
|
12
|
+
vi.mock('@wagmi/connectors', () => ({
|
|
13
|
+
injected: vi.fn(() => ({ id: 'injected' })), walletConnect: vi.fn(() => ({ id: 'walletConnect' })),
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
import { provideBlockAuth } from './provide-block-auth';
|
|
17
|
+
import { BlockAuthService } from './block-auth.service';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'ba-probe', standalone: true,
|
|
21
|
+
template: `<span data-testid="probe">{{ ba.wallet().address ?? 'none' }}|{{ ba.openModals().join(',') }}</span>`,
|
|
22
|
+
})
|
|
23
|
+
class ProbeComponent { ba = inject(BlockAuthService); }
|
|
24
|
+
|
|
25
|
+
describe('BlockAuthService', () => {
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
resetUi();
|
|
28
|
+
resetWallet();
|
|
29
|
+
resetUser();
|
|
30
|
+
closeAllModals();
|
|
31
|
+
setLocale('en');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('expone signals reactivos del estado del core y las acciones', async () => {
|
|
35
|
+
const { detectChanges } = await render(ProbeComponent, {
|
|
36
|
+
providers: [provideBlockAuth({ apiKey: 'k', apiSecret: 's', walletConnectProjectId: 'pid' })],
|
|
37
|
+
});
|
|
38
|
+
expect(screen.getByTestId('probe').textContent).toBe('none|');
|
|
39
|
+
|
|
40
|
+
const svc = TestBed.inject(BlockAuthService);
|
|
41
|
+
svc.client.state.$wallet.setKey('address', '0xabc');
|
|
42
|
+
svc.client.openModal('signup');
|
|
43
|
+
detectChanges();
|
|
44
|
+
expect(screen.getByTestId('probe').textContent).toBe('0xabc|signup');
|
|
45
|
+
|
|
46
|
+
expect(typeof svc.logout).toBe('function');
|
|
47
|
+
expect(typeof svc.t('edit')).toBe('string');
|
|
48
|
+
expect(svc.t('edit')).toBe('Edit');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('expone user/roles derivados de $user y helpers de roles', async () => {
|
|
52
|
+
await render(ProbeComponent, {
|
|
53
|
+
providers: [provideBlockAuth({ apiKey: 'k', apiSecret: 's', walletConnectProjectId: 'pid' })],
|
|
54
|
+
});
|
|
55
|
+
const svc = TestBed.inject(BlockAuthService);
|
|
56
|
+
|
|
57
|
+
expect(svc.user()).toBeNull();
|
|
58
|
+
expect(svc.isLoadingUser()).toBe(false);
|
|
59
|
+
expect(svc.roles()).toEqual([]);
|
|
60
|
+
expect(svc.roleNames()).toEqual([]);
|
|
61
|
+
expect(svc.roleSlugs()).toEqual([]);
|
|
62
|
+
expect(svc.hasRole('admin')).toBe(false);
|
|
63
|
+
expect(svc.hasAnyRole(['admin'])).toBe(false);
|
|
64
|
+
expect(svc.hasAnyRoleBySlug(['admin'])).toBe(false);
|
|
65
|
+
|
|
66
|
+
const refreshed = await svc.refreshUserProfile();
|
|
67
|
+
expect(refreshed).toBeNull();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Injectable, computed, type Signal } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
$locale,
|
|
4
|
+
$user,
|
|
5
|
+
setLocale,
|
|
6
|
+
t as translate,
|
|
7
|
+
getUserRoles,
|
|
8
|
+
getUserRoleNames,
|
|
9
|
+
getUserRoleSlugs,
|
|
10
|
+
hasRole as hasRoleForUser,
|
|
11
|
+
hasRoleBySlug as hasRoleBySlugForUser,
|
|
12
|
+
hasAnyRole as hasAnyRoleForUser,
|
|
13
|
+
hasAnyRoleBySlug as hasAnyRoleBySlugForUser,
|
|
14
|
+
fetchUserProfile,
|
|
15
|
+
type BlockAuthClient,
|
|
16
|
+
type BlockAuthUserProfile,
|
|
17
|
+
type BlockAuthUserRole,
|
|
18
|
+
type Locale,
|
|
19
|
+
type TextKey,
|
|
20
|
+
} from '@block-auth.io/core';
|
|
21
|
+
import { injectBlockAuthClient } from './provide-block-auth';
|
|
22
|
+
import { injectStore } from './inject-store';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Facade de Angular para el BlockAuthClient (equivalente al conjunto de
|
|
26
|
+
* hooks/composables useBlockAuthWs/Ui/Wallet/Modal + useLocale +
|
|
27
|
+
* useBlockAuthUser de React/Vue). Se inyecta una única vez por raíz
|
|
28
|
+
* (`providedIn: 'root'`) y expone el estado del core como Signals de solo
|
|
29
|
+
* lectura, más las acciones del client para consumir directamente en
|
|
30
|
+
* templates standalone.
|
|
31
|
+
*/
|
|
32
|
+
@Injectable({ providedIn: 'root' })
|
|
33
|
+
export class BlockAuthService {
|
|
34
|
+
readonly client: BlockAuthClient = injectBlockAuthClient();
|
|
35
|
+
|
|
36
|
+
// Estado (equivalentes de useBlockAuthWs/Ui/Wallet/Modal)
|
|
37
|
+
readonly ws = injectStore(this.client.state.$ws);
|
|
38
|
+
readonly ui = injectStore(this.client.state.$ui);
|
|
39
|
+
readonly wallet = injectStore(this.client.state.$wallet);
|
|
40
|
+
readonly openModals = injectStore(this.client.state.$openModals);
|
|
41
|
+
|
|
42
|
+
// i18n (useLocale)
|
|
43
|
+
readonly locale = injectStore($locale);
|
|
44
|
+
readonly setLocale = setLocale;
|
|
45
|
+
t = (key: TextKey): string => translate(key, this.locale());
|
|
46
|
+
|
|
47
|
+
// Usuario + roles (useBlockAuthUser)
|
|
48
|
+
private readonly userState = injectStore($user);
|
|
49
|
+
readonly user: Signal<BlockAuthUserProfile | null> = computed(() => this.userState().user);
|
|
50
|
+
readonly isLoadingUser: Signal<boolean> = computed(() => this.userState().isLoadingUser);
|
|
51
|
+
readonly roles: Signal<BlockAuthUserRole[]> = computed(() => getUserRoles(this.user()));
|
|
52
|
+
readonly roleNames: Signal<string[]> = computed(() => getUserRoleNames(this.user()));
|
|
53
|
+
readonly roleSlugs: Signal<string[]> = computed(() => getUserRoleSlugs(this.user()));
|
|
54
|
+
hasRole = (roleName: string): boolean => hasRoleForUser(this.user(), roleName);
|
|
55
|
+
hasRoleBySlug = (slug: string): boolean => hasRoleBySlugForUser(this.user(), slug);
|
|
56
|
+
hasAnyRole = (names: string[] = []): boolean => hasAnyRoleForUser(this.user(), names);
|
|
57
|
+
hasAnyRoleBySlug = (slugs: string[] = []): boolean => hasAnyRoleBySlugForUser(this.user(), slugs);
|
|
58
|
+
async refreshUserProfile(): Promise<BlockAuthUserProfile | null> {
|
|
59
|
+
const provider = this.client.provider;
|
|
60
|
+
const wscUser = provider?.wsc?.user as { did?: string; address?: string } | undefined;
|
|
61
|
+
const u = this.user() as { did?: string; address?: string } | null;
|
|
62
|
+
const address = u?.did || u?.address || wscUser?.did || wscUser?.address || null;
|
|
63
|
+
if (!address) return null;
|
|
64
|
+
return fetchUserProfile(provider, address);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Acciones (passthrough del client, para templates)
|
|
68
|
+
web3Signup = (slug: string) => this.client.web3.signup(slug);
|
|
69
|
+
signupGoogle = (mode?: 'auth-code' | 'implicit') => this.client.oauth.signupGoogle(mode);
|
|
70
|
+
signupMicrosoft = () => this.client.oauth.signupMicrosoft();
|
|
71
|
+
requestSignin = () => this.client.requestSignin();
|
|
72
|
+
cancelTxns = () => this.client.cancelTxns();
|
|
73
|
+
logout = () => this.client.logout();
|
|
74
|
+
// `openModal`/`closeModal` son funciones standalone del core
|
|
75
|
+
// (`state.openModal`/`state.closeModal`), no métodos ligados a `client`:
|
|
76
|
+
// se asignan directamente, sin `.bind(this.client)`.
|
|
77
|
+
openModal = this.client.openModal;
|
|
78
|
+
closeModal = this.client.closeModal;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type { Locale, TextKey };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
import { render, screen, fireEvent } from '@testing-library/angular';
|
|
4
|
+
import { BtnBaseProviderComponent } from './btn-base-provider.component';
|
|
5
|
+
|
|
6
|
+
describe('BtnBaseProvider', () => {
|
|
7
|
+
it('renderiza el texto capitalizado y emite providerClicked al hacer click', async () => {
|
|
8
|
+
const onProviderClicked = vi.fn();
|
|
9
|
+
@Component({
|
|
10
|
+
standalone: true,
|
|
11
|
+
imports: [BtnBaseProviderComponent],
|
|
12
|
+
template: `<ba-btn-base-provider text="phantom" (providerClicked)="onClick()" />`,
|
|
13
|
+
})
|
|
14
|
+
class HostComponent {
|
|
15
|
+
onClick = onProviderClicked;
|
|
16
|
+
}
|
|
17
|
+
await render(HostComponent);
|
|
18
|
+
expect(screen.getByText('Phantom')).toBeTruthy();
|
|
19
|
+
await fireEvent.click(screen.getByRole('button'));
|
|
20
|
+
expect(onProviderClicked).toHaveBeenCalled();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Botón presentacional puro (sin client core), usado como bloque base por los
|
|
5
|
+
* paneles/pickers de selección de provider.
|
|
6
|
+
*/
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'ba-btn-base-provider',
|
|
9
|
+
standalone: true,
|
|
10
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
|
+
template: `
|
|
12
|
+
<button [class]="btnClass()" (click)="onClick($event)">
|
|
13
|
+
<ng-content select="[slot=icon]" />
|
|
14
|
+
@if (text() && text() !== '') {
|
|
15
|
+
<p [class]="'bas-m-0 bas-text-gray-700 ' + textClass()">{{ capitalizedText() }}</p>
|
|
16
|
+
}
|
|
17
|
+
</button>
|
|
18
|
+
`,
|
|
19
|
+
})
|
|
20
|
+
export class BtnBaseProviderComponent {
|
|
21
|
+
borderClassNames = input('bas-border-2 bas-border-slate-300');
|
|
22
|
+
sizeClassNames = input('bas-h-16 bas-w-full');
|
|
23
|
+
text = input('');
|
|
24
|
+
isEditable = input(false);
|
|
25
|
+
device = input<'desktop' | 'phone'>('desktop');
|
|
26
|
+
|
|
27
|
+
providerClicked = output<void>();
|
|
28
|
+
|
|
29
|
+
onClick(e: MouseEvent): void {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
this.providerClicked.emit();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private innerClass = computed(() => {
|
|
35
|
+
if (!this.isEditable()) return 'bas-gap-1 bas-px-1 sm1:bas-gap-4 sm1:bas-px-2';
|
|
36
|
+
if (this.device() === 'phone') return 'bas-gap-1 bas-px-1';
|
|
37
|
+
return 'bas-gap-4 bas-px-2';
|
|
38
|
+
});
|
|
39
|
+
textClass = computed(() => {
|
|
40
|
+
if (!this.isEditable()) return 'bas-text-base sm1:bas-text-lg';
|
|
41
|
+
if (this.device() === 'phone') return 'bas-text-base';
|
|
42
|
+
return 'bas-text-lg';
|
|
43
|
+
});
|
|
44
|
+
capitalizedText = computed(() => {
|
|
45
|
+
const t = this.text();
|
|
46
|
+
return t ? t.charAt(0).toUpperCase() + t.slice(1) : t;
|
|
47
|
+
});
|
|
48
|
+
btnClass = computed(
|
|
49
|
+
() =>
|
|
50
|
+
`bal-ba-outline-none bal-ba-transition-2 bas-box-border bas-flex bas-cursor-pointer
|
|
51
|
+
bas-items-center bas-rounded-lg bas-border-solid bas-bg-transparent bas-py-0
|
|
52
|
+
${this.borderClassNames()} ${this.innerClass()} ${this.sizeClassNames()}
|
|
53
|
+
${this.text() && this.text() !== '' ? 'bas-flex-row' : 'bas-justify-center'}`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/angular';
|
|
3
|
+
import { map } from 'nanostores';
|
|
4
|
+
import {
|
|
5
|
+
resetExtension,
|
|
6
|
+
setExtensionInstalled,
|
|
7
|
+
setExtensionIsUser,
|
|
8
|
+
setExtensionIsUserActive,
|
|
9
|
+
setExtensionIsLocked,
|
|
10
|
+
} from '@block-auth.io/core';
|
|
11
|
+
import { BtnBlockAuthComponent } from './btn-block-auth.component';
|
|
12
|
+
import { provideBlockAuthClientForTest } from '../../testing';
|
|
13
|
+
|
|
14
|
+
function makeClient() {
|
|
15
|
+
const connectBlockAuth = vi.fn();
|
|
16
|
+
const $ui = map({ isSdkSignedIn: false, uiConfig: null });
|
|
17
|
+
const $ws = map({ ready: false });
|
|
18
|
+
const client = { connectBlockAuth, state: { $ui, $ws } } as any;
|
|
19
|
+
return { client, connectBlockAuth, $ui, $ws };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ready(c: ReturnType<typeof makeClient>): void {
|
|
23
|
+
c.$ws.setKey('ready', true);
|
|
24
|
+
c.$ui.setKey('isSdkSignedIn', true);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe('BtnBlockAuth', () => {
|
|
28
|
+
beforeEach(() => resetExtension());
|
|
29
|
+
|
|
30
|
+
it('renderiza con el id de provider y es clickable', async () => {
|
|
31
|
+
const { client } = makeClient();
|
|
32
|
+
await render(BtnBlockAuthComponent, { providers: [provideBlockAuthClientForTest(client)] });
|
|
33
|
+
expect(screen.getByRole('button').id).toBe('btn-provider-blockauth');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('abre la Chrome Web Store cuando la extensión no está instalada', async () => {
|
|
37
|
+
const c = makeClient();
|
|
38
|
+
const { client, connectBlockAuth } = c;
|
|
39
|
+
ready(c);
|
|
40
|
+
const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null);
|
|
41
|
+
await render(BtnBlockAuthComponent, { providers: [provideBlockAuthClientForTest(client)] });
|
|
42
|
+
setExtensionInstalled(false);
|
|
43
|
+
await fireEvent.click(screen.getByRole('button'));
|
|
44
|
+
expect(openSpy).toHaveBeenCalledWith(expect.stringContaining('chromewebstore'), '_blank');
|
|
45
|
+
expect(connectBlockAuth).not.toHaveBeenCalled();
|
|
46
|
+
openSpy.mockRestore();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('despacha ext:open cuando está instalada pero el usuario aún no está activo', async () => {
|
|
50
|
+
const c = makeClient();
|
|
51
|
+
const { client, connectBlockAuth } = c;
|
|
52
|
+
ready(c);
|
|
53
|
+
const dispatchSpy = vi.spyOn(document, 'dispatchEvent');
|
|
54
|
+
await render(BtnBlockAuthComponent, { providers: [provideBlockAuthClientForTest(client)] });
|
|
55
|
+
setExtensionInstalled(true);
|
|
56
|
+
setExtensionIsUser(true);
|
|
57
|
+
setExtensionIsUserActive(false);
|
|
58
|
+
await fireEvent.click(screen.getByRole('button'));
|
|
59
|
+
const dispatchedExtOpen = dispatchSpy.mock.calls.some(
|
|
60
|
+
(c) => (c[0] as Event).type === 'ext:open',
|
|
61
|
+
);
|
|
62
|
+
expect(dispatchedExtOpen).toBe(true);
|
|
63
|
+
expect(connectBlockAuth).not.toHaveBeenCalled();
|
|
64
|
+
dispatchSpy.mockRestore();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('llama client.connectBlockAuth cuando está lista, activa y no conectada', async () => {
|
|
68
|
+
const c = makeClient();
|
|
69
|
+
const { client, connectBlockAuth } = c;
|
|
70
|
+
ready(c);
|
|
71
|
+
await render(BtnBlockAuthComponent, { providers: [provideBlockAuthClientForTest(client)] });
|
|
72
|
+
setExtensionInstalled(true);
|
|
73
|
+
setExtensionIsUser(true);
|
|
74
|
+
setExtensionIsUserActive(true);
|
|
75
|
+
setExtensionIsLocked(false);
|
|
76
|
+
await fireEvent.click(screen.getByRole('button'));
|
|
77
|
+
expect(connectBlockAuth).toHaveBeenCalledOnce();
|
|
78
|
+
});
|
|
79
|
+
});
|