// src/components/docs/integrations/IntegrationsPowensPage.tsx
import Link from "@contractspec/lib.ui-link";
import { ChevronRight } from "lucide-react";
import { jsx, jsxs } from "react/jsx-runtime";
function IntegrationsPowensPage() {
  return /* @__PURE__ */ jsxs("div", {
    className: "space-y-8",
    children: [
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h1", {
            className: "text-4xl font-bold",
            children: "Powens Open Banking"
          }),
          /* @__PURE__ */ jsx("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."
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Setup"
          }),
          /* @__PURE__ */ jsx("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:"
          }),
          /* @__PURE__ */ jsx("div", {
            className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded-lg border p-4 font-mono text-sm",
            children: /* @__PURE__ */ jsx("pre", {
              children: `{
  "clientId": "powens-client-id",
  "clientSecret": "powens-client-secret",
  "apiKey": "optional-api-key",
  "webhookSecret": "optional-webhook-secret"
}`
            })
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground text-sm",
            children: "Configure non-secret settings on the integration connection:"
          }),
          /* @__PURE__ */ jsx("div", {
            className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded-lg border p-4 font-mono text-sm",
            children: /* @__PURE__ */ jsx("pre", {
              children: `environment: sandbox | production
baseUrl?: https://api-sandbox.powens.com/v2
region?: eu-west-1
pollingIntervalMs?: 300000`
            })
          }),
          /* @__PURE__ */ jsxs("p", {
            className: "text-muted-foreground text-sm",
            children: [
              "See the",
              " ",
              /* @__PURE__ */ jsx("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."
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Capabilities"
          }),
          /* @__PURE__ */ jsx("div", {
            className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded-lg border p-4 font-mono text-sm",
            children: /* @__PURE__ */ jsx("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"`
            })
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Primary workflows"
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h3", {
                className: "text-lg font-semibold",
                children: "Account sync"
              }),
              /* @__PURE__ */ jsxs("p", {
                className: "text-muted-foreground",
                children: [
                  "The workflow",
                  " ",
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "pfo.workflow.sync-openbanking-accounts"
                  }),
                  " ",
                  "refreshes account metadata, then surfaces canonical records to other automations."
                ]
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h3", {
                className: "text-lg font-semibold",
                children: "Transaction sync"
              }),
              /* @__PURE__ */ jsxs("p", {
                className: "text-muted-foreground",
                children: [
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "pfo.workflow.sync-openbanking-transactions"
                  }),
                  " ",
                  "ingests incremental transactions for each linked account and stores them in the canonical ledger."
                ]
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h3", {
                className: "text-lg font-semibold",
                children: "Balance refresh"
              }),
              /* @__PURE__ */ jsxs("p", {
                className: "text-muted-foreground",
                children: [
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "pfo.workflow.refresh-openbanking-balances"
                  }),
                  " ",
                  "retrieves current and available balances to power dashboards and anomaly detection."
                ]
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h3", {
                className: "text-lg font-semibold",
                children: "Derived financial overview"
              }),
              /* @__PURE__ */ jsxs("p", {
                className: "text-muted-foreground",
                children: [
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "pfo.workflow.generate-openbanking-overview"
                  }),
                  " ",
                  "aggregates balances, category breakdowns, and cashflow trends into the ",
                  /* @__PURE__ */ jsx("code", {
                    children: "knowledge.financial-overview"
                  }),
                  " space. Only derived summaries are exposed to LLMs."
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Telemetry & guardrails"
          }),
          /* @__PURE__ */ jsxs("ul", {
            className: "text-muted-foreground list-inside list-disc space-y-2",
            children: [
              /* @__PURE__ */ jsxs("li", {
                children: [
                  "Telemetry events such as",
                  " ",
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "openbanking.accounts.synced"
                  }),
                  " ",
                  "and",
                  " ",
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "openbanking.transactions.synced"
                  }),
                  " ",
                  "are emitted automatically with tenant, slot, and config metadata."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  "Guard helpers ensure the",
                  " ",
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "primaryOpenBanking"
                  }),
                  " ",
                  "slot is bound and healthy before workflows execute."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  "PII fields (IBAN, counterparty names, descriptions) are redacted via",
                  " ",
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "redactOpenBankingTelemetryPayload"
                  }),
                  " ",
                  "before logging or sending telemetry."
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Best practices"
          }),
          /* @__PURE__ */ jsxs("ul", {
            className: "text-muted-foreground list-inside list-disc space-y-2",
            children: [
              /* @__PURE__ */ jsx("li", {
                children: "Use BYOK credentials per tenant to avoid cross-tenant exposure."
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Store only canonical entities (BankAccountRecord, BankTransactionRecord). Never persist raw Powens payloads or customer PII in logs."
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Run the transaction sync on a schedule appropriate for banking SLAs (e.g. every 15 minutes for cashflow dashboards)."
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Pair ledger updates with derived summaries to feed the knowledge layer instead of exposing raw transactions to agents."
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  "Monitor telemetry for",
                  " ",
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "openbanking.*.sync_failed"
                  }),
                  " ",
                  "events to detect credential issues early."
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/integrations",
            className: "btn-ghost",
            children: "Back to Integrations"
          }),
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/integrations/stripe",
            className: "btn-primary",
            children: [
              "Next: Stripe ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          })
        ]
      })
    ]
  });
}
export {
  IntegrationsPowensPage
};
