Context
DFXswiss/services contains several thin API layers (types + useApi/call wrappers) that are customer/product API contracts, not widget- or staff-UI. Those belong in this monorepo (@dfx.swiss/core + @dfx.swiss/react) so other consumers can reuse them without depending on services.
Staff/compliance, RealUnit tenant, dashboard, and widget shell stay in services.
Goal
Move (or re-export) the shared wire contract into packages, then switch services to the published package APIs and drop the local duplicates.
Scope — extract into packages
1. Virtual / personal IBAN (create) — high priority
|
|
| Source (services) |
src/hooks/virtual-iban.hook.ts, src/dto/virtual-iban.dto.ts |
| Target |
@dfx.swiss/core (URL + types + optional BuyApi method) and @dfx.swiss/react (hook, e.g. useVirtualIban / extend useBuy) |
| API |
POST buy/personalIban |
| Already in packages |
PersonalIbanProvider, isPersonalIban / buy quote fields (BuyPaymentInfo.personalIbanProvider) |
| Gap |
Create endpoint client + VirtualIban / CreateVirtualIban DTOs |
Also consider pure domain helpers from services/src/util/personal-iban.ts (normalize provider, request mapping). Keep widget/URL param handling (personal-iban query, web-component) in services.
2. Recommendation (customer API) — high priority
|
|
| Source (services) |
src/hooks/recommendation.hook.ts, src/dto/recommendation.dto.ts |
| Target |
core: URLs + types; react: useRecommendation |
| API |
GET/POST recommendation, PUT recommendation/:id/confirm, PUT recommendation/:id/reject |
| Already in packages |
Auth already accepts recommendationCode |
| Note |
Customer-facing only. Staff recommendation graph (support/recommendation-graph/…) stays in services compliance. |
3. Payment Link pay-flow contract — medium priority
packages already covers Payment Link CRUD (PaymentLinksApi, usePaymentRoutes, PaymentLink, PaymentLinkPayment, PaymentStandardType, …).
Missing from packages, still only in services:
|
|
| Source (services) |
src/dto/payment-link.dto.ts (and related call sites in payment-link contexts) |
| Target |
core definitions (+ optional client methods); re-export from react |
| Candidates |
PaymentStandard, PaymentLinkPayTerminal, PaymentLinkPayRequest, Quote, TransferInfo / TransferMethod, C2BPaymentMethod, RecipientInfo (pay-flow shape), wait/history URL helpers if stable |
| Related endpoints used only in services today |
e.g. paymentLink/standard, paymentLink/payment, paymentLink/payment/wait, paymentLink/history (verify against current API before freezing) |
Do not move: POS UI orchestration, MetaMask pay UI, polling timers, merchant session storage — those stay in services.
4. Custody / Safe API client — medium priority
|
|
| Source (services) |
src/hooks/safe.hook.ts, src/dto/safe.dto.ts, src/dto/order.dto.ts |
| Target |
core: CustodyApi (or similar) + types; react: useCustody / useSafe |
| API (customer) |
custody, custody/account, balances/history/order, confirm order, … |
| Already in packages |
JWT role Custody |
| Do not move |
Staff admin paths (custody/admin/orders, approve) — those stay under services compliance |
5. Blockchain helper API — optional / lower priority
|
|
| Source (services) |
src/hooks/blockchain-balance.hook.ts, src/hooks/blockchain-transaction.hook.ts |
| Target |
core client + react hooks |
| API |
POST blockchain/balances, POST blockchain/transaction, POST blockchain/broadcast |
Useful for any wallet-integrated consumer; not required if only services uses them long-term.
Explicitly out of scope (stay in services)
- Staff / compliance:
compliance.hook.ts, MROS, recall, Scorechain, call queues, AML review/reset, KYC admin
- Internal financial dashboard (
dashboard/*)
- RealUnit (customer + compliance + support tenant APIs)
- Support staff dashboard (
support/issue/list, clerks, statistics, templates) — customer chat is already in packages (useSupportChat / SupportApi)
- Widget shell:
app-handling.context, web component, screens, i18n, charts, wallet adapters, PDF builders
Suggested delivery order
- Virtual/personal IBAN create + DTOs
- Recommendation customer API
- Payment Link pay-request types (+ any missing stable endpoints)
- Custody/Safe customer client
- Blockchain helpers (optional)
Each step: implement in packages → publish (beta then stable per release process) → bump @dfx.swiss/react / @dfx.swiss/core in services → delete local duplicates.
Acceptance criteria
References
- packages CONSUMERS: e.g.
DFXswiss/services (pinned npm deps)
- Local analysis: services has ~188 files importing
@dfx.swiss/react, but many extra API paths only via local useApi() wrappers
- Related existing packages surface: buy (
PersonalIbanProvider), payment links CRUD, support customer chat, bank receive-IBAN check
Context
DFXswiss/servicescontains several thin API layers (types +useApi/callwrappers) that are customer/product API contracts, not widget- or staff-UI. Those belong in this monorepo (@dfx.swiss/core+@dfx.swiss/react) so other consumers can reuse them without depending on services.Staff/compliance, RealUnit tenant, dashboard, and widget shell stay in services.
Goal
Move (or re-export) the shared wire contract into packages, then switch services to the published package APIs and drop the local duplicates.
Scope — extract into packages
1. Virtual / personal IBAN (create) — high priority
src/hooks/virtual-iban.hook.ts,src/dto/virtual-iban.dto.ts@dfx.swiss/core(URL + types + optionalBuyApimethod) and@dfx.swiss/react(hook, e.g.useVirtualIban/ extenduseBuy)POST buy/personalIbanPersonalIbanProvider,isPersonalIban/ buy quote fields (BuyPaymentInfo.personalIbanProvider)VirtualIban/CreateVirtualIbanDTOsAlso consider pure domain helpers from
services/src/util/personal-iban.ts(normalize provider, request mapping). Keep widget/URL param handling (personal-ibanquery, web-component) in services.2. Recommendation (customer API) — high priority
src/hooks/recommendation.hook.ts,src/dto/recommendation.dto.tsuseRecommendationGET/POST recommendation,PUT recommendation/:id/confirm,PUT recommendation/:id/rejectrecommendationCodesupport/recommendation-graph/…) stays in services compliance.3. Payment Link pay-flow contract — medium priority
packages already covers Payment Link CRUD (
PaymentLinksApi,usePaymentRoutes,PaymentLink,PaymentLinkPayment,PaymentStandardType, …).Missing from packages, still only in services:
src/dto/payment-link.dto.ts(and related call sites in payment-link contexts)PaymentStandard,PaymentLinkPayTerminal,PaymentLinkPayRequest,Quote,TransferInfo/TransferMethod,C2BPaymentMethod,RecipientInfo(pay-flow shape), wait/history URL helpers if stablepaymentLink/standard,paymentLink/payment,paymentLink/payment/wait,paymentLink/history(verify against current API before freezing)Do not move: POS UI orchestration, MetaMask pay UI, polling timers, merchant session storage — those stay in services.
4. Custody / Safe API client — medium priority
src/hooks/safe.hook.ts,src/dto/safe.dto.ts,src/dto/order.dto.tsCustodyApi(or similar) + types; react:useCustody/useSafecustody,custody/account, balances/history/order, confirm order, …Custodycustody/admin/orders, approve) — those stay under services compliance5. Blockchain helper API — optional / lower priority
src/hooks/blockchain-balance.hook.ts,src/hooks/blockchain-transaction.hook.tsPOST blockchain/balances,POST blockchain/transaction,POST blockchain/broadcastUseful for any wallet-integrated consumer; not required if only services uses them long-term.
Explicitly out of scope (stay in services)
compliance.hook.ts, MROS, recall, Scorechain, call queues, AML review/reset, KYC admindashboard/*)support/issue/list, clerks, statistics, templates) — customer chat is already in packages (useSupportChat/SupportApi)app-handling.context, web component, screens, i18n, charts, wallet adapters, PDF buildersSuggested delivery order
Each step: implement in packages → publish (beta then stable per release process) → bump
@dfx.swiss/react/@dfx.swiss/corein services → delete local duplicates.Acceptance criteria
@dfx.swiss/core(and are re-exported from@dfx.swiss/reactwhere hooks exist today)dto/hookcopies for in-scope items are removedReferences
DFXswiss/services(pinned npm deps)@dfx.swiss/react, but many extra API paths only via localuseApi()wrappersPersonalIbanProvider), payment links CRUD, support customer chat, bank receive-IBAN check