// @bun
var G=Object.defineProperty;var H=(A)=>A;function I(A,B){this[A]=H.bind(null,B)}var K=(A,B)=>{for(var D in B)G(A,D,{get:B[D],enumerable:!0,configurable:!0,set:I.bind(B,D)})};var M=(A,B)=>()=>(A&&(B=A(A=0)),B);import E from"@contractspec/lib.ui-link";import{ChevronRight as J}from"lucide-react";import{jsx as q,jsxs as z}from"react/jsx-runtime";function U(){return z("div",{className:"space-y-8",children:[z("div",{className:"space-y-4",children:[q("h1",{className:"font-bold text-4xl",children:"Powens Open Banking"}),q("p",{className:"text-muted-foreground",children:"Powens provides read-only open banking connectivity for ContractSpec applications. The reference integration powers Pocket Family Office by synchronising household bank accounts, transactions, and balances while keeping all raw PII protected."})]}),z("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Setup"}),q("p",{className:"text-muted-foreground",children:"Create a Powens BYOK project, then store the credentials in your secret manager. The ContractSpec integration expects the following fields:"}),q("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:q("pre",{children:`{
  "clientId": "powens-client-id",
  "clientSecret": "powens-client-secret",
  "apiKey": "optional-api-key",
  "webhookSecret": "optional-webhook-secret"
}`})}),q("p",{className:"text-muted-foreground text-sm",children:"Configure non-secret settings on the integration connection:"}),q("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:q("pre",{children:`environment: sandbox | production
baseUrl?: https://api-sandbox.powens.com/v2
region?: eu-west-1
pollingIntervalMs?: 300000`})}),z("p",{className:"text-muted-foreground text-sm",children:["See the"," ",q("a",{href:"https://docs.powens.com/documentation/integration-guides/quick-start/api-overview",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"Powens API documentation"})," ","for information on generating credentials and managing BYOK projects."]})]}),z("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Capabilities"}),q("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:q("pre",{children:`capabilityId: openbanking.accounts.read
provider:
  type: openbanking.powens
  operation: listAccounts

outputs:
  accounts:
    type: BankAccountRecord[]
    description: "Canonical bank account metadata (institution, currency, balances)"

---

capabilityId: openbanking.transactions.read
provider:
  type: openbanking.powens
  operation: listTransactions

inputs:
  accountId:
    type: string
  from?:
    type: string
    description: "ISO timestamp lower bound"
  to?:
    type: string

outputs:
  transactions:
    type: BankTransactionRecord[]
    description: "Canonical transaction ledger entries"

---

capabilityId: openbanking.balances.read
provider:
  type: openbanking.powens
  operation: getBalances

inputs:
  accountId:
    type: string
  balanceTypes?:
    type: string[]

outputs:
  balances:
    type: AccountBalanceRecord[]
    description: "Current/available balances with timestamps"`})})]}),z("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Primary workflows"}),z("div",{className:"space-y-3",children:[q("h3",{className:"font-semibold text-lg",children:"Account sync"}),z("p",{className:"text-muted-foreground",children:["The workflow"," ",q("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.sync-openbanking-accounts"})," ","refreshes account metadata, then surfaces canonical records to other automations."]})]}),z("div",{className:"space-y-3",children:[q("h3",{className:"font-semibold text-lg",children:"Transaction sync"}),z("p",{className:"text-muted-foreground",children:[q("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.sync-openbanking-transactions"})," ","ingests incremental transactions for each linked account and stores them in the canonical ledger."]})]}),z("div",{className:"space-y-3",children:[q("h3",{className:"font-semibold text-lg",children:"Balance refresh"}),z("p",{className:"text-muted-foreground",children:[q("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.refresh-openbanking-balances"})," ","retrieves current and available balances to power dashboards and anomaly detection."]})]}),z("div",{className:"space-y-3",children:[q("h3",{className:"font-semibold text-lg",children:"Derived financial overview"}),z("p",{className:"text-muted-foreground",children:[q("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.generate-openbanking-overview"})," ","aggregates balances, category breakdowns, and cashflow trends into the ",q("code",{children:"knowledge.financial-overview"})," space. Only derived summaries are exposed to LLMs."]})]})]}),z("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Telemetry & guardrails"}),z("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[z("li",{children:["Telemetry events such as"," ",q("code",{className:"rounded bg-background/50 px-2 py-1",children:"openbanking.accounts.synced"})," ","and"," ",q("code",{className:"rounded bg-background/50 px-2 py-1",children:"openbanking.transactions.synced"})," ","are emitted automatically with tenant, slot, and config metadata."]}),z("li",{children:["Guard helpers ensure the"," ",q("code",{className:"rounded bg-background/50 px-2 py-1",children:"primaryOpenBanking"})," ","slot is bound and healthy before workflows execute."]}),z("li",{children:["PII fields (IBAN, counterparty names, descriptions) are redacted via"," ",q("code",{className:"rounded bg-background/50 px-2 py-1",children:"redactOpenBankingTelemetryPayload"})," ","before logging or sending telemetry."]})]})]}),z("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Best practices"}),z("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[q("li",{children:"Use BYOK credentials per tenant to avoid cross-tenant exposure."}),q("li",{children:"Store only canonical entities (BankAccountRecord, BankTransactionRecord). Never persist raw Powens payloads or customer PII in logs."}),q("li",{children:"Run the transaction sync on a schedule appropriate for banking SLAs (e.g. every 15 minutes for cashflow dashboards)."}),q("li",{children:"Pair ledger updates with derived summaries to feed the knowledge layer instead of exposing raw transactions to agents."}),z("li",{children:["Monitor telemetry for"," ",q("code",{className:"rounded bg-background/50 px-2 py-1",children:"openbanking.*.sync_failed"})," ","events to detect credential issues early."]})]})]}),z("div",{className:"flex items-center gap-4 pt-4",children:[q(E,{href:"/docs/integrations",className:"btn-ghost",children:"Back to Integrations"}),z(E,{href:"/docs/integrations/stripe",className:"btn-primary",children:["Next: Stripe ",q(J,{size:16})]})]})]})}export{U as IntegrationsPowensPage};
