Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/pages/sdk/me-client/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ export const metadata = {
- [ActivityAttestationBundle](interfaces/ActivityAttestationBundle.mdx)
- [ActivityVerifyCheck](interfaces/ActivityVerifyCheck.mdx)
- [ActivityVerifyResult](interfaces/ActivityVerifyResult.mdx)
- [AgentClassOverride](interfaces/AgentClassOverride.mdx)
- [ArchetypeTemplate](interfaces/ArchetypeTemplate.mdx)
- [BillableEvent](interfaces/BillableEvent.mdx)
- [ComputedFees](interfaces/ComputedFees.mdx)
- [DropClosedWebhookPayload](interfaces/DropClosedWebhookPayload.mdx)
- [DropResponseBlock](interfaces/DropResponseBlock.mdx)
- [DropScheduleSummary](interfaces/DropScheduleSummary.mdx)
- [EventSubtypeMetadata](interfaces/EventSubtypeMetadata.mdx)
- [FamilyScopesOptions](interfaces/FamilyScopesOptions.mdx)
- [FamilyScopesResult](interfaces/FamilyScopesResult.mdx)
Expand All @@ -39,6 +43,7 @@ export const metadata = {
- [Session](interfaces/Session.mdx)
- [SessionPolicy](interfaces/SessionPolicy.mdx)
- [SignInOptions](interfaces/SignInOptions.mdx)
- [SystemWebhookPayload](interfaces/SystemWebhookPayload.mdx)
- [TelemetryEvent](interfaces/TelemetryEvent.mdx)
- [TrustAttestationCount](interfaces/TrustAttestationCount.mdx)
- [ValidationResult](interfaces/ValidationResult.mdx)
Expand All @@ -56,6 +61,7 @@ export const metadata = {
- [ClassASubtype](type-aliases/ClassASubtype.mdx)
- [ClassBSubtype](type-aliases/ClassBSubtype.mdx)
- [ClassCSubtype](type-aliases/ClassCSubtype.mdx)
- [DropCadence](type-aliases/DropCadence.mdx)
- [EventClass](type-aliases/EventClass.mdx)
- [EventSubtype](type-aliases/EventSubtype.mdx)
- [FamilyVerb](type-aliases/FamilyVerb.mdx)
Expand All @@ -75,6 +81,7 @@ export const metadata = {
- [family](variables/family.mdx)
- [federations](variables/federations.mdx)
- [identity](variables/identity.mdx)
- [MAX\_DROP\_WINDOW\_DAYS](variables/MAX_DROP_WINDOW_DAYS.mdx)
- [MIN\_INTEGRATOR\_PRICE\_SATS](variables/MIN_INTEGRATOR_PRICE_SATS.mdx)
- [oc](variables/oc.mdx)
- [payment](variables/payment.mdx)
Expand Down
36 changes: 26 additions & 10 deletions src/pages/sdk/me-client/functions/computeFees.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,44 @@ export const metadata = {
# Function: computeFees()

```ts
function computeFees(cfg: IntegratorEventConfig, payment_amount_sats?: number): ComputedFees;
function computeFees(
cfg: IntegratorEventConfig,
payment_amount_sats?: number,
opts?: {
is_agent?: boolean;
}): ComputedFees;
```

Defined in: [me-client/src/types.ts:120](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L120)
Defined in: [me-client/src/types.ts:156](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L156)

Compute the four-way fee split for an event given an integrator's
config and (for percent_of_amount events) the underlying payment
amount.

Invariants (verified by tests in oc-me-web/src/lib/events/types.test.ts):
1. gross_fee_sats >= MIN_INTEGRATOR_PRICE_SATS
2. platform_fee_sats >= PLATFORM_FEE_POLICY.min_floor_sats
3. user_share_pct is clamped to [0, 0.8]
4. site_rebate_sats >= 0
5. gross == platform + user + rebate (exact, modulo rounding into rebate)
amount. MIRRORS oc-me-web/src/lib/events/types.ts computeFees()
EXACTLY — the SDK-side replay (oc.event.verify) re-runs this against
envelopes the server billed, so any drift is a false "divergence".

Invariants:
1. gross_fee_sats >= MIN_INTEGRATOR_PRICE_SATS (1-sat atomic floor)
2. platform_fee_sats = min(gross, max(min_floor, round(gross × pct)))
— bounded above by gross so a 1-sat event can't owe more
platform fee than it grossed
3. user_earned_sats = min(gross − platform, round(gross × share)),
share clamped to [0, 0.8]
4. site_rebate_sats = gross − platform − user (exact remainder)
5. gross == platform + user + rebate exactly

When `opts.is_agent` is true AND the config has an `agent` override,
the agent's site_pays / user_share_pct apply. `agent.refuse: true`
throws 'agent_refused' (the server maps it to 422).

## Parameters

| Parameter | Type |
| ------ | ------ |
| `cfg` | [`IntegratorEventConfig`](../interfaces/IntegratorEventConfig.mdx) |
| `payment_amount_sats?` | `number` |
| `opts?` | \{ `is_agent?`: `boolean`; \} |
| `opts.is_agent?` | `boolean` |

## Returns

Expand Down
2 changes: 1 addition & 1 deletion src/pages/sdk/me-client/functions/subtypesForClass.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const metadata = {
function subtypesForClass(cls: EventClass): EventSubtypeMetadata[];
```

Defined in: [me-client/src/subtypes.ts:179](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/subtypes.ts#L179)
Defined in: [me-client/src/subtypes.ts:180](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/subtypes.ts#L180)

All subtypes for a given class · convenience accessor.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const metadata = {
function validateIntegratorConfig(cfg: IntegratorPriceConfig): ValidationResult;
```

Defined in: [me-client/src/types.ts:157](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L157)
Defined in: [me-client/src/types.ts:205](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L205)

Validate an integrator's pricing config against the platform's
non-negotiable rules. Run client-side before posting; the server runs
Expand Down
29 changes: 29 additions & 0 deletions src/pages/sdk/me-client/interfaces/AgentClassOverride.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const metadata = {
title: "Interface: AgentClassOverride",
description: "Auto-generated API reference for Interface: AgentClassOverride. Source: TypeScript types in oc-packages.",
};

[**@orangecheck/me-client**](../README.mdx)

***

[@orangecheck/me-client](../README.mdx) / AgentClassOverride

# Interface: AgentClassOverride

Defined in: [me-client/src/types.ts:90](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L90)

Optional per-class pricing overrides · per OCHK-V3-PLAN §7 phase-1.
Agents acting under a scoped oc-agent delegation may bill
differently than humans firing the same subtype. When `agent` is
unset on a subtype, agent traffic bills at the human rate. `refuse:
true` makes the subtype human-only — the endpoint returns 422
agent_refused for is_agent=true requests.

## Properties

| Property | Type | Description | Defined in |
| ------ | ------ | ------ | ------ |
| <a id="property-refuse"></a> `refuse?` | `boolean` | When true, agent traffic is refused for this subtype. | [me-client/src/types.ts:96](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L96) |
| <a id="property-site_pays"></a> `site_pays?` | [`SiteFeeShape`](../type-aliases/SiteFeeShape.mdx) | Override site_pays for agent-fired events. | [me-client/src/types.ts:92](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L92) |
| <a id="property-user_share_pct"></a> `user_share_pct?` | `number` | Override user_share_pct. Same default-fallback as site_pays. | [me-client/src/types.ts:94](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L94) |
29 changes: 15 additions & 14 deletions src/pages/sdk/me-client/interfaces/BillableEvent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const metadata = {

# Interface: BillableEvent

Defined in: [me-client/src/types.ts:200](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L200)
Defined in: [me-client/src/types.ts:248](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L248)

## Extended by

Expand All @@ -21,16 +21,17 @@ Defined in: [me-client/src/types.ts:200](https://github.com/orangecheck/oc-packa

| Property | Type | Description | Defined in |
| ------ | ------ | ------ | ------ |
| <a id="property-class"></a> `class` | [`EventClass`](../type-aliases/EventClass.mdx) | - | [me-client/src/types.ts:203](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L203) |
| <a id="property-gross_fee_sats"></a> `gross_fee_sats` | `number` | - | [me-client/src/types.ts:206](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L206) |
| <a id="property-id"></a> `id` | `string` | - | [me-client/src/types.ts:201](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L201) |
| <a id="property-is_agent"></a> `is_agent?` | `boolean` | Per OCHK-V3-PLAN §7 phase-1 · true when the event was fired by an oc-agent delegation rather than a human session. The integrator's IntegratorEventConfig.agent block may price these differently or refuse them. Optional · canonical encoder branches to v=3 only when present, so legacy human-fired events keep their v=2 hash + signature. | [me-client/src/types.ts:217](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L217) |
| <a id="property-occurred_at"></a> `occurred_at` | `string` | - | [me-client/src/types.ts:202](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L202) |
| <a id="property-platform_fee_sats"></a> `platform_fee_sats` | `number` | - | [me-client/src/types.ts:207](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L207) |
| <a id="property-site"></a> `site` | \{ `display_name`: `string`; `domain`: `string`; \} | - | [me-client/src/types.ts:205](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L205) |
| `site.display_name` | `string` | - | [me-client/src/types.ts:205](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L205) |
| `site.domain` | `string` | - | [me-client/src/types.ts:205](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L205) |
| <a id="property-site_rebate_sats"></a> `site_rebate_sats` | `number` | - | [me-client/src/types.ts:209](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L209) |
| <a id="property-subtype"></a> `subtype` | [`EventSubtype`](../type-aliases/EventSubtype.mdx) | - | [me-client/src/types.ts:204](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L204) |
| <a id="property-user_earned_sats"></a> `user_earned_sats` | `number` | - | [me-client/src/types.ts:208](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L208) |
| <a id="property-verify_url"></a> `verify_url` | `string` | - | [me-client/src/types.ts:210](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L210) |
| <a id="property-class"></a> `class` | [`EventClass`](../type-aliases/EventClass.mdx) | - | [me-client/src/types.ts:251](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L251) |
| <a id="property-drop"></a> `drop?` | \| \{ `close_height_target`: `number` \| `null`; `window_id`: `string`; \} \| `null` | Drop-period stamp · present when the project covers this subtype with a drop schedule. The user-share of a stamped event MATURES until the window's boundary, then vests as one batch (the drop). Billing is untouched. Part of the SIGNED canonical bytes (encoder branches to v=4 when present). No clawback exists — vesting is unconditional, and an open window's boundary can only ever move earlier. | [me-client/src/types.ts:273](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L273) |
| <a id="property-gross_fee_sats"></a> `gross_fee_sats` | `number` | - | [me-client/src/types.ts:254](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L254) |
| <a id="property-id"></a> `id` | `string` | - | [me-client/src/types.ts:249](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L249) |
| <a id="property-is_agent"></a> `is_agent?` | `boolean` | Per OCHK-V3-PLAN §7 phase-1 · true when the event was fired by an oc-agent delegation rather than a human session. The integrator's IntegratorEventConfig.agent block may price these differently or refuse them. Optional · canonical encoder branches to v=3 only when present, so legacy human-fired events keep their v=2 hash + signature. | [me-client/src/types.ts:265](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L265) |
| <a id="property-occurred_at"></a> `occurred_at` | `string` | - | [me-client/src/types.ts:250](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L250) |
| <a id="property-platform_fee_sats"></a> `platform_fee_sats` | `number` | - | [me-client/src/types.ts:255](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L255) |
| <a id="property-site"></a> `site` | \{ `display_name`: `string`; `domain`: `string`; \} | - | [me-client/src/types.ts:253](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L253) |
| `site.display_name` | `string` | - | [me-client/src/types.ts:253](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L253) |
| `site.domain` | `string` | - | [me-client/src/types.ts:253](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L253) |
| <a id="property-site_rebate_sats"></a> `site_rebate_sats` | `number` | - | [me-client/src/types.ts:257](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L257) |
| <a id="property-subtype"></a> `subtype` | [`EventSubtype`](../type-aliases/EventSubtype.mdx) | - | [me-client/src/types.ts:252](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L252) |
| <a id="property-user_earned_sats"></a> `user_earned_sats` | `number` | - | [me-client/src/types.ts:256](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L256) |
| <a id="property-verify_url"></a> `verify_url` | `string` | - | [me-client/src/types.ts:258](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L258) |
10 changes: 5 additions & 5 deletions src/pages/sdk/me-client/interfaces/ComputedFees.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const metadata = {

# Interface: ComputedFees

Defined in: [me-client/src/types.ts:102](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L102)
Defined in: [me-client/src/types.ts:130](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L130)

A computed fee breakdown for a single event. site_rebate_sats is what
flows back to the integrator's OC balance after OC's platform fee and
Expand All @@ -21,7 +21,7 @@ A computed fee breakdown for a single event. site_rebate_sats is what

| Property | Type | Defined in |
| ------ | ------ | ------ |
| <a id="property-gross_fee_sats"></a> `gross_fee_sats` | `number` | [me-client/src/types.ts:103](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L103) |
| <a id="property-platform_fee_sats"></a> `platform_fee_sats` | `number` | [me-client/src/types.ts:104](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L104) |
| <a id="property-site_rebate_sats"></a> `site_rebate_sats` | `number` | [me-client/src/types.ts:106](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L106) |
| <a id="property-user_earned_sats"></a> `user_earned_sats` | `number` | [me-client/src/types.ts:105](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L105) |
| <a id="property-gross_fee_sats"></a> `gross_fee_sats` | `number` | [me-client/src/types.ts:131](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L131) |
| <a id="property-platform_fee_sats"></a> `platform_fee_sats` | `number` | [me-client/src/types.ts:132](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L132) |
| <a id="property-site_rebate_sats"></a> `site_rebate_sats` | `number` | [me-client/src/types.ts:134](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L134) |
| <a id="property-user_earned_sats"></a> `user_earned_sats` | `number` | [me-client/src/types.ts:133](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L133) |
48 changes: 48 additions & 0 deletions src/pages/sdk/me-client/interfaces/DropClosedWebhookPayload.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
export const metadata = {
title: "Interface: DropClosedWebhookPayload",
description: "Auto-generated API reference for Interface: DropClosedWebhookPayload. Source: TypeScript types in oc-packages.",
};

[**@orangecheck/me-client**](../README.mdx)

***

[@orangecheck/me-client](../README.mdx) / DropClosedWebhookPayload

# Interface: DropClosedWebhookPayload

Defined in: [me-client/src/types.ts:393](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L393)

The `drop.closed` system event — one per closed drop window. The
manifest is the signed, content-addressed record (Merkle commitments
over member events + recipients); verify_url renders + live-verifies
it, and /api/envelope/<manifest_id> serves the raw canonical bytes.

## Extends

- [`SystemWebhookPayload`](SystemWebhookPayload.mdx)

## Indexable

```ts
[extra: string]: unknown
```

## Properties

| Property | Type | Overrides | Inherited from | Defined in |
| ------ | ------ | ------ | ------ | ------ |
| <a id="property-event_count"></a> `event_count` | `number` | - | - | [me-client/src/types.ts:402](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L402) |
| <a id="property-gross_fee_sats"></a> `gross_fee_sats` | `number` | - | - | [me-client/src/types.ts:404](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L404) |
| <a id="property-kind"></a> `kind` | `"oc-system-event"` | - | [`SystemWebhookPayload`](SystemWebhookPayload.mdx).[`kind`](SystemWebhookPayload.mdx#property-kind) | [me-client/src/types.ts:383](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L383) |
| <a id="property-label"></a> `label` | `string` | - | - | [me-client/src/types.ts:397](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L397) |
| <a id="property-manifest_id"></a> `manifest_id` | `string` | - | - | [me-client/src/types.ts:398](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L398) |
| <a id="property-project_key"></a> `project_key` | `string` | - | [`SystemWebhookPayload`](SystemWebhookPayload.mdx).[`project_key`](SystemWebhookPayload.mdx#property-project_key) | [me-client/src/types.ts:385](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L385) |
| <a id="property-recipient_count"></a> `recipient_count` | `number` | - | - | [me-client/src/types.ts:403](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L403) |
| <a id="property-schedule_id"></a> `schedule_id` | `string` | - | - | [me-client/src/types.ts:396](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L396) |
| <a id="property-sealed_at"></a> `sealed_at` | `string` | - | - | [me-client/src/types.ts:400](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L400) |
| <a id="property-sealed_height"></a> `sealed_height` | `number` \| `null` | - | - | [me-client/src/types.ts:401](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L401) |
| <a id="property-subtype"></a> `subtype` | `"drop.closed"` | [`SystemWebhookPayload`](SystemWebhookPayload.mdx).[`subtype`](SystemWebhookPayload.mdx#property-subtype) | - | [me-client/src/types.ts:394](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L394) |
| <a id="property-user_share_sats"></a> `user_share_sats` | `number` | - | - | [me-client/src/types.ts:405](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L405) |
| <a id="property-verify_url"></a> `verify_url` | `string` | - | - | [me-client/src/types.ts:399](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L399) |
| <a id="property-window_id"></a> `window_id` | `string` | - | - | [me-client/src/types.ts:395](https://github.com/orangecheck/oc-packages/blob/main/me-client/src/types.ts#L395) |
Loading