@orangecheck/me-client 0.60.0 → 0.61.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/CHANGELOG.md +20 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -3
- package/dist/index.mjs.map +1 -1
- package/dist/integrator.js +4 -1
- package/dist/integrator.js.map +1 -1
- package/dist/integrator.mjs +4 -1
- package/dist/integrator.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,26 @@ this file tracks the package's TS / Node / runtime API surface.
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.61.0] — 2026-11-12
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- `event.fire` takes `note`, as a batch entry already does. It is sent inside
|
|
18
|
+
the signed body.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- The `note` comment on `BatchEventInput` adds the 280-character limit, that a
|
|
23
|
+
class B or C built-in drops it, and the `invalid_note` refusal. A note is
|
|
24
|
+
public: it is in the event's receipt, which anyone with its link can read.
|
|
25
|
+
- The `payment_amount_sats` comments on `FireEventOptions` and
|
|
26
|
+
`BatchEventInput` say whole sats above 0, as me.ochk.io reads it, and that an
|
|
27
|
+
agent's event is priced by the agent price when one is set.
|
|
28
|
+
- `event.verify` prices an event an agent fired (`is_agent`) by its subtype's
|
|
29
|
+
agent override, as me.ochk.io does, and asks for a payment amount only when
|
|
30
|
+
that price is a percent of one. An agent's event under a subtype that
|
|
31
|
+
refuses agents is reported as `agent_refused`, a new issue field.
|
|
32
|
+
|
|
13
33
|
## [0.60.0] — 2026-11-11
|
|
14
34
|
|
|
15
35
|
### Changed
|
package/dist/index.d.mts
CHANGED
|
@@ -68,6 +68,7 @@ interface FireEventOptions {
|
|
|
68
68
|
project_key: string;
|
|
69
69
|
subtype: EventKey;
|
|
70
70
|
action_label?: string;
|
|
71
|
+
note?: string;
|
|
71
72
|
payment_amount_sats?: number;
|
|
72
73
|
metadata?: Record<string, unknown>;
|
|
73
74
|
is_agent?: boolean;
|
|
@@ -136,7 +137,7 @@ declare function fireBatch(options: FireBatchOptions): Promise<FireBatchResponse
|
|
|
136
137
|
interface VerifyEventResult {
|
|
137
138
|
ok: boolean;
|
|
138
139
|
issues: Array<{
|
|
139
|
-
field: 'gross_fee_sats' | 'platform_fee_sats' | 'user_earned_sats' | 'site_rebate_sats' | 'subtype_disabled' | 'subtype_unconfigured' | 'percent_amount_missing' | 'outside_pay_period';
|
|
140
|
+
field: 'gross_fee_sats' | 'platform_fee_sats' | 'user_earned_sats' | 'site_rebate_sats' | 'subtype_disabled' | 'subtype_unconfigured' | 'percent_amount_missing' | 'agent_refused' | 'outside_pay_period';
|
|
140
141
|
expected: number | null;
|
|
141
142
|
actual: number | null;
|
|
142
143
|
message: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ interface FireEventOptions {
|
|
|
68
68
|
project_key: string;
|
|
69
69
|
subtype: EventKey;
|
|
70
70
|
action_label?: string;
|
|
71
|
+
note?: string;
|
|
71
72
|
payment_amount_sats?: number;
|
|
72
73
|
metadata?: Record<string, unknown>;
|
|
73
74
|
is_agent?: boolean;
|
|
@@ -136,7 +137,7 @@ declare function fireBatch(options: FireBatchOptions): Promise<FireBatchResponse
|
|
|
136
137
|
interface VerifyEventResult {
|
|
137
138
|
ok: boolean;
|
|
138
139
|
issues: Array<{
|
|
139
|
-
field: 'gross_fee_sats' | 'platform_fee_sats' | 'user_earned_sats' | 'site_rebate_sats' | 'subtype_disabled' | 'subtype_unconfigured' | 'percent_amount_missing' | 'outside_pay_period';
|
|
140
|
+
field: 'gross_fee_sats' | 'platform_fee_sats' | 'user_earned_sats' | 'site_rebate_sats' | 'subtype_disabled' | 'subtype_unconfigured' | 'percent_amount_missing' | 'agent_refused' | 'outside_pay_period';
|
|
140
141
|
expected: number | null;
|
|
141
142
|
actual: number | null;
|
|
142
143
|
message: string;
|
package/dist/index.js
CHANGED
|
@@ -320,12 +320,15 @@ var INHERITED_NAMES = new Set(
|
|
|
320
320
|
function isInheritedName(key) {
|
|
321
321
|
return INHERITED_NAMES.has(key.toLowerCase());
|
|
322
322
|
}
|
|
323
|
+
function sitePaysFor(cfg, is_agent) {
|
|
324
|
+
return is_agent && cfg.agent?.site_pays ? cfg.agent.site_pays : cfg.site_pays;
|
|
325
|
+
}
|
|
323
326
|
function computeFees(cfg, payment_amount_sats, opts) {
|
|
324
327
|
const is_agent = opts?.is_agent === true;
|
|
325
328
|
if (is_agent && cfg.agent?.refuse) {
|
|
326
329
|
throw new Error("agent_refused");
|
|
327
330
|
}
|
|
328
|
-
const effective_site_pays =
|
|
331
|
+
const effective_site_pays = sitePaysFor(cfg, is_agent);
|
|
329
332
|
const effective_user_share_pct = is_agent && typeof cfg.agent?.user_share_pct === "number" ? cfg.agent.user_share_pct : cfg.user_share_pct;
|
|
330
333
|
let gross = 0;
|
|
331
334
|
if (effective_site_pays.kind === "fixed_sats") {
|
|
@@ -490,6 +493,7 @@ async function fire(options) {
|
|
|
490
493
|
if (options.payment_amount_sats !== void 0)
|
|
491
494
|
requestBody.payment_amount_sats = options.payment_amount_sats;
|
|
492
495
|
if (options.action_label !== void 0) requestBody.action_label = options.action_label;
|
|
496
|
+
if (options.note !== void 0) requestBody.note = options.note;
|
|
493
497
|
if (options.is_agent !== void 0) requestBody.is_agent = options.is_agent;
|
|
494
498
|
if (earner !== void 0) requestBody.user_address = earner;
|
|
495
499
|
const headers = {};
|
|
@@ -575,7 +579,23 @@ function verify(envelope, config2, payment_amount_sats, opts = {}) {
|
|
|
575
579
|
]
|
|
576
580
|
};
|
|
577
581
|
}
|
|
578
|
-
|
|
582
|
+
const is_agent = envelope.is_agent === true;
|
|
583
|
+
if (is_agent && eventCfg.agent?.refuse) {
|
|
584
|
+
return {
|
|
585
|
+
ok: false,
|
|
586
|
+
expected: null,
|
|
587
|
+
issues: [
|
|
588
|
+
...issues,
|
|
589
|
+
{
|
|
590
|
+
field: "agent_refused",
|
|
591
|
+
expected: null,
|
|
592
|
+
actual: null,
|
|
593
|
+
message: `subtype ${envelope.subtype} refuses agents on integrator ${config2.project_key} but an agent's event was billed`
|
|
594
|
+
}
|
|
595
|
+
]
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
if (sitePaysFor(eventCfg, is_agent).kind === "percent_of_amount" && payment_amount_sats == null) {
|
|
579
599
|
return {
|
|
580
600
|
ok: false,
|
|
581
601
|
expected: null,
|
|
@@ -590,7 +610,7 @@ function verify(envelope, config2, payment_amount_sats, opts = {}) {
|
|
|
590
610
|
]
|
|
591
611
|
};
|
|
592
612
|
}
|
|
593
|
-
const expected = computeFees(eventCfg, payment_amount_sats);
|
|
613
|
+
const expected = computeFees(eventCfg, payment_amount_sats, { is_agent });
|
|
594
614
|
if (envelope.gross_fee_sats !== expected.gross_fee_sats) {
|
|
595
615
|
issues.push({
|
|
596
616
|
field: "gross_fee_sats",
|