feat(packages): add standalone auth and payment
Some checks failed
Release / release-branches (auth) (push) Has been cancelled
Release / release-branches (payment) (push) Has been cancelled
Release / version-pr (push) Has been cancelled

This commit is contained in:
2026-08-21 08:08:42 +04:00
parent 216d376167
commit 5ffc1b1450
28 changed files with 5855 additions and 26 deletions

View File

@@ -2,8 +2,30 @@
Shared client packages consumed by `marketplaces` and other projects.
- `packages/auth``@marketplaces/auth`. Real implementation. Two independent mechanisms: `telegram/` (live QR/session auth, customer + admin) and `ed25519/` (challenge/response admin auth, backend not shipped yet).
- `packages/payment``@marketplaces/payment`. Scaffold only, no implementation yet.
- `packages/auth``@marketplaces/auth`. Standalone Angular UI + gateway for QR, credentials and Yandex auth.
- `packages/payment``@marketplaces/payment`. Standalone Angular UI + gateway for QR, card, SBP and Yandex Pay.
The packages call separate central services. They never derive or call the tenant API. Each request automatically includes the page hostname as `X-Marketplace-Domain`; central Auth/Payment APIs resolve that domain to the project.
```ts
bootstrapApplication(AppComponent, {
providers: [
provideHttpClient(),
provideMarketplacesAuth({ apiUrl: 'https://auth.example.net' }),
provideMarketplacesPayment({ apiUrl: 'https://payments.example.net' }),
],
});
```
```html
<mp-auth qr credentials yandex mode="admin"
(authenticated)="onLogin($event)" />
<mp-payment qr card sbp yandexPay [request]="checkout"
(completed)="onPaid($event)" />
```
Import `MarketplacesAuthComponent` / `MarketplacesPaymentComponent` into the consuming standalone component. See `docs/BACKEND-CONTRACT.md` for central API and CORS requirements.
Consumer documentation lives in the `marketplaces` repo: `docs/PACKAGES-USAGE.md`. Rationale: `docs/context/adrs/ADR-0001-extract-auth-and-payment-into-shared-marketplaces-packages.md`.