Skip to content

feat: @orangecheck/me-client v0.1.0 — drop-in client for me.ochk.io#3

Merged
Xaxis merged 1 commit into
mainfrom
feat/me-client
Apr 30, 2026
Merged

feat: @orangecheck/me-client v0.1.0 — drop-in client for me.ochk.io#3
Xaxis merged 1 commit into
mainfrom
feat/me-client

Conversation

@Xaxis
Copy link
Copy Markdown
Contributor

@Xaxis Xaxis commented Apr 30, 2026

Summary

The integrator-side SDK for me.ochk.io. Mirrors the public surface documented at /integrate so the on-page code samples become real imports.

import { OcSignInButton, oc, onTelemetry } from '@orangecheck/me-client';

Exports

  • <OcSignInButton> React component — triggers the me.ochk.io consent flow, returns the resulting Session via onSignin. Class C billable atom; signin within an open session is FREE.
  • oc.session.{create, refresh, invalidate} — session lifecycle hooks. create is billable; refresh and invalidate are non-billable telemetry-only.
  • oc.payment.authorize(...) — Class B billable event. Sub-Stripe rates; ~65% of the OC fee flows to the user as Lightning cashback.
  • onTelemetry(listener) — subscribe to non-billable events (intra-session signins, refreshes, failed/cancelled, navigation, passive verifies).
  • Canonical types: BillableEvent, EventClass, EventSubtype, SessionPolicy, PaymentResult, TelemetryEvent — mirrors oc-me-web/src/lib/events/types.ts.
  • setOrigin(url) — swap the origin for staging or self-hosted me-equivalents.

Stack

tsup → CJS + ESM + DTS. Peer deps: react, react-dom, @orangecheck/auth-client. Mirrors the auth-client package layout exactly.

Test plan

  • yarn type-check — clean
  • yarn test — 3 tests pass
  • yarn build — CJS (5.22 KB) + ESM (4.55 KB) + DTS (3.79 KB) all emitted
  • Reviewer eyeballs the public API matches what /integrate documents
  • Publish to npm via the standard oc-packages Packages workflow once merged

🤖 Generated with Claude Code

The integrator-side SDK for me.ochk.io. Mirrors the public surface
documented at /integrate so the on-page code samples become real
imports:

  import { OcSignInButton, oc, onTelemetry } from '@orangecheck/me-client';

Exports:

  - <OcSignInButton scope={...} sessionPolicy={...} onSignin={...}/>
    React component. Triggers the me.ochk.io consent flow, returns the
    resulting Session via onSignin. Class C billable atom — once per
    real session, signin within an open session is FREE.

  - oc.session.{create, refresh, invalidate}
    Session lifecycle hooks. create() is the billable atom; refresh
    and invalidate are non-billable telemetry-only. Site declares the
    SessionPolicy at integration time (banking 15-60min, SaaS 7-30d,
    mobile 90d are the canonical shapes).

  - oc.payment.authorize({ amount_sats|usd_cents, description, ... })
    Class B billable event. Sub-Stripe rates; ~65% of the OC fee
    flows to the user as Lightning cashback on /me/earn.

  - onTelemetry(listener) -> unsubscribe
    Subscribe to the developer telemetry stream — non-billable events
    like session.token_refresh, auth.signin_cancelled,
    verify.passive_check. Site has full observability of what users
    are doing without paying for it.

  - Canonical types: BillableEvent, EventClass ('A'|'B'|'C'),
    EventSubtype, SessionPolicy, PaymentResult, TelemetryEvent.
    Mirrors oc-me-web/src/lib/events/types.ts; same source of truth
    for the three-class taxonomy from Addendum 01.

  - setOrigin(url): swap the me.ochk.io origin for staging or
    self-hosted me-equivalents. Default origin is https://me.ochk.io.

Stack: tsup → CJS + ESM + DTS, peer deps on react/react-dom and
@orangecheck/auth-client. Mirrors the auth-client package layout.
3 tests pass, type-check clean, build green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Xaxis Xaxis merged commit 777606a into main Apr 30, 2026
21 checks passed
@Xaxis Xaxis deleted the feat/me-client branch April 30, 2026 17:40
Xaxis added a commit that referenced this pull request Apr 30, 2026
The Packages workflow's build matrix was missing me-client, so PR #3
(me-client v0.1.0) merged green without ever building or testing the
new package — and never auto-published to npm. v0.1.0 was published
manually via NPM_TOKEN to unblock /integrate code samples.

This commit closes that gap so future me-client versions go through
the same gate every other package does:

  - packages.yml: add me-client to the build matrix.
  - release.yml: add me-client-v* to the tag-trigger list, plus a
    matching docstring entry.

After merge, future releases ship with: yarn version → git tag
me-client-v0.X.0 → git push --tags. Packages CI runs build+test on
every push, release.yml publishes on tag push.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Xaxis added a commit that referenced this pull request Apr 30, 2026
…Fees (#5)

* ci: add me-client to packages build matrix + release tag list

The Packages workflow's build matrix was missing me-client, so PR #3
(me-client v0.1.0) merged green without ever building or testing the
new package — and never auto-published to npm. v0.1.0 was published
manually via NPM_TOKEN to unblock /integrate code samples.

This commit closes that gap so future me-client versions go through
the same gate every other package does:

  - packages.yml: add me-client to the build matrix.
  - release.yml: add me-client-v* to the tag-trigger list, plus a
    matching docstring entry.

After merge, future releases ship with: yarn version → git tag
me-client-v0.X.0 → git push --tags. Packages CI runs build+test on
every push, release.yml publishes on tag push.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: @orangecheck/me-client v0.2.0 — IntegratorPriceConfig + computeFees

Mirror the systemic refactor in oc-me-web. The package now exports the
canonical integrator-configurable pricing types:

  - IntegratorPriceConfig — what every integrator declares
  - IntegratorEventConfig — per-subtype { enabled, site_pays, user_share_pct }
  - SiteFeeShape — { kind: 'fixed_sats' | 'percent_of_amount', ... }
  - ComputedFees — the four-way split: gross / platform / user / site_rebate

Plus the platform constants OC inherits to all integrators:

  - PLATFORM_FEE_POLICY = { pct: 0.2, min_floor_sats: 1, ratified }
  - MIN_INTEGRATOR_PRICE_SATS = 5
  - computeFees(cfg, payment_amount?) helper for client-side preview

Type bundle grew 3.79 KB → 4.81 KB.

Already published manually; this commit makes the version bump
auditable in git history. Future versions auto-publish on
me-client-v0.X.0 tags now that PR #4 added me-client to the release
workflow's tag list.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant