@orangecheck/me-client 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { v as verifyActivityAttestation, r as refreshEnvelopeJwks } from './identity-1VYMOhzV.mjs';
2
2
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity } from './identity-1VYMOhzV.mjs';
3
- import { E as EventSubtype, B as BillableEvent, I as IntegratorPriceConfig, S as SessionPolicy, a as Session, T as TelemetryEvent, b as SignInOptions, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation } from './integrator-m712Srxt.mjs';
4
- export { d as ALL_EVENT_SUBTYPES, e as ARCHETYPE_TEMPLATES, h as AttestTier, C as ClassASubtype, i as ClassBSubtype, j as ClassCSubtype, k as ComputedFees, l as EVENT_SUBTYPES, m as EventClass, n as EventSubtypeMetadata, o as FederationStatus, p as IntegratorArchetype, q as IntegratorEventConfig, M as MIN_INTEGRATOR_PRICE_SATS, r as PLATFORM_FEE_POLICY, s as SigningMethod, t as SiteFeeShape, W as WebhookHeaders, u as WebhookPayload, v as computeFees, w as subtypesForClass, x as validateIntegratorConfig } from './integrator-m712Srxt.mjs';
3
+ import { E as EventSubtype, B as BillableEvent, I as IntegratorPriceConfig, S as SessionPolicy, a as Session, T as TelemetryEvent, b as SignInOptions, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation } from './integrator-BLBD-0q4.mjs';
4
+ export { d as ALL_EVENT_SUBTYPES, e as ARCHETYPE_TEMPLATES, h as AgentClassOverride, i as AttestTier, C as ClassASubtype, j as ClassBSubtype, k as ClassCSubtype, l as ComputedFees, D as DropCadence, m as DropClosedWebhookPayload, n as DropResponseBlock, o as DropScheduleSummary, p as EVENT_SUBTYPES, q as EventClass, r as EventSubtypeMetadata, s as FederationStatus, t as IntegratorArchetype, u as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, v as MIN_INTEGRATOR_PRICE_SATS, w as PLATFORM_FEE_POLICY, x as SigningMethod, y as SiteFeeShape, z as SystemWebhookPayload, W as WebhookHeaders, G as WebhookPayload, H as computeFees, J as subtypesForClass, K as validateIntegratorConfig } from './integrator-BLBD-0q4.mjs';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as React from 'react';
7
7
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { v as verifyActivityAttestation, r as refreshEnvelopeJwks } from './identity-1VYMOhzV.js';
2
2
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity } from './identity-1VYMOhzV.js';
3
- import { E as EventSubtype, B as BillableEvent, I as IntegratorPriceConfig, S as SessionPolicy, a as Session, T as TelemetryEvent, b as SignInOptions, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation } from './integrator-m712Srxt.js';
4
- export { d as ALL_EVENT_SUBTYPES, e as ARCHETYPE_TEMPLATES, h as AttestTier, C as ClassASubtype, i as ClassBSubtype, j as ClassCSubtype, k as ComputedFees, l as EVENT_SUBTYPES, m as EventClass, n as EventSubtypeMetadata, o as FederationStatus, p as IntegratorArchetype, q as IntegratorEventConfig, M as MIN_INTEGRATOR_PRICE_SATS, r as PLATFORM_FEE_POLICY, s as SigningMethod, t as SiteFeeShape, W as WebhookHeaders, u as WebhookPayload, v as computeFees, w as subtypesForClass, x as validateIntegratorConfig } from './integrator-m712Srxt.js';
3
+ import { E as EventSubtype, B as BillableEvent, I as IntegratorPriceConfig, S as SessionPolicy, a as Session, T as TelemetryEvent, b as SignInOptions, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation } from './integrator-BLBD-0q4.js';
4
+ export { d as ALL_EVENT_SUBTYPES, e as ARCHETYPE_TEMPLATES, h as AgentClassOverride, i as AttestTier, C as ClassASubtype, j as ClassBSubtype, k as ClassCSubtype, l as ComputedFees, D as DropCadence, m as DropClosedWebhookPayload, n as DropResponseBlock, o as DropScheduleSummary, p as EVENT_SUBTYPES, q as EventClass, r as EventSubtypeMetadata, s as FederationStatus, t as IntegratorArchetype, u as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, v as MIN_INTEGRATOR_PRICE_SATS, w as PLATFORM_FEE_POLICY, x as SigningMethod, y as SiteFeeShape, z as SystemWebhookPayload, W as WebhookHeaders, G as WebhookPayload, H as computeFees, J as subtypesForClass, K as validateIntegratorConfig } from './integrator-BLBD-0q4.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as React from 'react';
7
7
 
package/dist/index.js CHANGED
@@ -269,27 +269,34 @@ var PLATFORM_FEE_POLICY = {
269
269
  * @orangecheck/me-client release. */
270
270
  ratified: "2026-04-30"
271
271
  };
272
- var MIN_INTEGRATOR_PRICE_SATS = 5;
273
- function computeFees(cfg, payment_amount_sats) {
272
+ var MIN_INTEGRATOR_PRICE_SATS = 1;
273
+ var MAX_DROP_WINDOW_DAYS = 92;
274
+ function computeFees(cfg, payment_amount_sats, opts) {
275
+ const is_agent = opts?.is_agent === true;
276
+ if (is_agent && cfg.agent?.refuse) {
277
+ throw new Error("agent_refused");
278
+ }
279
+ const effective_site_pays = is_agent && cfg.agent?.site_pays ? cfg.agent.site_pays : cfg.site_pays;
280
+ const effective_user_share_pct = is_agent && typeof cfg.agent?.user_share_pct === "number" ? cfg.agent.user_share_pct : cfg.user_share_pct;
274
281
  let gross = 0;
275
- if (cfg.site_pays.kind === "fixed_sats") {
276
- gross = Math.max(MIN_INTEGRATOR_PRICE_SATS, Math.round(cfg.site_pays.sats));
282
+ if (effective_site_pays.kind === "fixed_sats") {
283
+ gross = Math.max(MIN_INTEGRATOR_PRICE_SATS, Math.round(effective_site_pays.sats));
277
284
  } else {
278
285
  if (payment_amount_sats == null) {
279
286
  throw new Error("percent_of_amount config requires payment_amount_sats");
280
287
  }
281
288
  gross = Math.max(
282
289
  MIN_INTEGRATOR_PRICE_SATS,
283
- Math.round(payment_amount_sats * cfg.site_pays.pct)
290
+ Math.round(payment_amount_sats * effective_site_pays.pct)
284
291
  );
285
292
  }
286
- const platform_fee_sats = Math.max(
287
- PLATFORM_FEE_POLICY.min_floor_sats,
288
- Math.round(gross * PLATFORM_FEE_POLICY.pct)
293
+ const platform_fee_sats = Math.min(
294
+ gross,
295
+ Math.max(PLATFORM_FEE_POLICY.min_floor_sats, Math.round(gross * PLATFORM_FEE_POLICY.pct))
289
296
  );
290
- const user_share = Math.min(0.8, Math.max(0, cfg.user_share_pct));
291
- const user_earned_sats = Math.round(gross * user_share);
292
- const site_rebate_sats = Math.max(0, gross - platform_fee_sats - user_earned_sats);
297
+ const user_share = Math.min(0.8, Math.max(0, effective_user_share_pct));
298
+ const user_earned_sats = Math.min(gross - platform_fee_sats, Math.round(gross * user_share));
299
+ const site_rebate_sats = gross - platform_fee_sats - user_earned_sats;
293
300
  return { gross_fee_sats: gross, platform_fee_sats, user_earned_sats, site_rebate_sats };
294
301
  }
295
302
  function validateIntegratorConfig(cfg) {
@@ -1449,10 +1456,10 @@ var EVENT_SUBTYPES = {
1449
1456
  id: "pledge_resolution",
1450
1457
  class: "B",
1451
1458
  label: "pledge resolved",
1452
- fires_when: "an oc-pledge bonded commitment resolves (paid out, slashed, or refunded) on your surface",
1453
- example: "user staked 50k sats on a prediction; market resolved and the pledge paid out",
1459
+ fires_when: "an oc-pledge bonded commitment resolves on your surface (kept / broken / disputed / expired_unresolved). pledge bonds never move \u2014 any sat payout is an integrator-composed flow on top of pledge (e.g., HTLC), not a pledge primitive (oc-pledge-protocol WHY.md H7)",
1460
+ example: "user staked sats \xD7 days-unspent on a prediction; the pledge resolved kept and the integrator paid out per its own composed terms",
1454
1461
  common_use_cases: ["pledge", "staking", "resolution", "commit-reveal"],
1455
- typical_price_hint: "1% of pledge amount (percent_of_amount) \xB7 OFF by default"
1462
+ typical_price_hint: "1% of pledge bond amount (percent_of_amount) \xB7 OFF by default"
1456
1463
  },
1457
1464
  // ── Class C · session ──
1458
1465
  session_creation: {
@@ -1490,6 +1497,7 @@ var oc = {
1490
1497
  exports.ALL_EVENT_SUBTYPES = ALL_EVENT_SUBTYPES;
1491
1498
  exports.ARCHETYPE_TEMPLATES = ARCHETYPE_TEMPLATES;
1492
1499
  exports.EVENT_SUBTYPES = EVENT_SUBTYPES;
1500
+ exports.MAX_DROP_WINDOW_DAYS = MAX_DROP_WINDOW_DAYS;
1493
1501
  exports.MIN_INTEGRATOR_PRICE_SATS = MIN_INTEGRATOR_PRICE_SATS;
1494
1502
  exports.MeClientError = MeClientError;
1495
1503
  exports.OcSignInButton = OcSignInButton;