@alytegen/sdk 0.4.0 → 0.6.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/BROWSER.md CHANGED
@@ -1,9 +1,36 @@
1
1
  # Buyer purchases inside your chat
2
2
 
3
- Available in SDK 0.4.0 with Alyte's Model 1 browser endpoints. The merchant token
4
- stays on your backend. Your chat receives a short-lived bounded buyer bearer;
5
- creating or widening permission requires email verification inside Alyte's iframe.
6
- The full verification bearer stays there. No raw agent credential reaches your chat.
3
+ Available since SDK 0.4.0 with Alyte's Model 1 browser endpoints (0.5.0 and later type the attested
4
+ mint). The merchant token stays on your backend. Your chat receives a short-lived bounded
5
+ buyer bearer. How a permission gets created depends on the session you minted:
6
+ **merchant-attested** (enabled merchants, within staff-set ceilings) — Alyte's iframe creates
7
+ it on your attestation, no code; **ordinary** — the iframe asks the buyer to confirm a code
8
+ Alyte emails them. Either way the verification happens inside Alyte's iframe, and the full
9
+ verification bearer stays there. No raw agent credential reaches your chat.
10
+ Your pages and your backend must never call the step-up endpoints or handle the
11
+ buyer's verification code; the iframe does that. A code entered anywhere in your own
12
+ UI is a defect in the integration. The step-up endpoints refuse browser calls from
13
+ partner origins; that refusal is a browser boundary, not a substitute for this rule.
14
+
15
+ Prerequisite: this flow is offered to merchants onboarded under an Alyte contract,
16
+ which carries the rule above. Alyte is invite-onboarded and production keys need
17
+ Alyte's go-live approval; the contract is checked at those steps, not by the
18
+ minting or exchange endpoints themselves.
19
+
20
+ ## Availability and contracted attestation
21
+
22
+ The separately enabled merchant-attested path can grant within staff-set
23
+ ceilings without the emailed code. Mint that session on your backend with an
24
+ attest-only key and `merchantAttested: true`, then exchange it and call
25
+ `openConsent` as below. SDK 0.5.0 and later type the mint field
26
+ (`buyerSessions.mint({ merchantId, email, merchantAttested: true })`); the
27
+ [REST example](https://alyte.mintlify.site/guides/console-api-keys) shows the same call without the SDK.
28
+ The API key never belongs in the browser. Removing staff enablement or revoking
29
+ the key removes the session's attestation exception.
30
+
31
+ The emailed-link confirmation flow proposed earlier is withdrawn and will not ship.
32
+ Ordinary sessions confirm the emailed verification code inside Alyte's iframe, and
33
+ the SDK has no pending-consent client methods.
7
34
 
8
35
  ## Register and attest
9
36
 
@@ -11,8 +38,10 @@ Register your exact HTTPS chat origin in the shop's `embedOrigin` (multiple orig
11
38
  are comma-separated). This controls both framing and buyer CORS. New registrations
12
39
  can take up to 30 seconds to reach preflight caches. Local HTTP development is supported.
13
40
  On your backend, authenticate your own user, derive their email from that session,
14
- then call `merchant.buyerSessions.mint({ merchantId, email })`. Return only the `token`
15
- query value extracted from `new URL(session.redeemPath, ALYTE_URL)` to that user's
41
+ then call `merchant.buyerSessions.mint({ merchantId, email })` — or, on a `mandates:attest`
42
+ key for an enabled merchant, `mint({ merchantId, email, merchantAttested: true })` so the
43
+ buyer can create a permission within your ceilings without the emailed code. Return only the
44
+ `token` query value extracted from `new URL(session.redeemPath, ALYTE_URL)` to that user's
16
45
  browser. Do not navigate the redeem link too: either consumer uses the token once.
17
46
  The mint endpoint must not accept an arbitrary browser-supplied email as identity.
18
47
 
@@ -28,7 +57,7 @@ const { agentId, mandateId } = await openConsent({
28
57
  baseUrl: ALYTE_URL, merchantId, bearer: connection.bearer,
29
58
  container: document.querySelector<HTMLElement>('#alyte-consent')!,
30
59
  signal: controller.signal, lang: 'en',
31
- theme: { accent: '#006466', font: 'sans', radius: 8, scheme: 'light' },
60
+ theme: { accent: '#006466', radius: 8, scheme: 'light' },
32
61
  });
33
62
  ```
34
63
 
@@ -39,7 +68,8 @@ Cookie login endpoints are not available to the parent chat.
39
68
 
40
69
  The iframe lets the buyer choose an existing usable Alyte agent/permission or
41
70
  create one. Selecting an existing permission needs no new email verification.
42
- Creating authority does. Completion returns IDs only and removes the iframe.
71
+ Creating authority does, except for an enabled merchant-attested session within
72
+ its ceilings. Completion returns IDs only and removes the iframe.
43
73
  Cancellation/abort rejects with `AlyteConsentError.code = 'consent_cancelled'`;
44
74
  an initial handshake timeout uses `consent_unavailable`. Server errors retain their
45
75
  code. `readyTimeoutMs` defaults to 15 seconds and never limits code-entry time.
@@ -48,6 +78,9 @@ Optional `returnUrl` must belong to the chat origin. `onNavigate(url)` decides h
48
78
  your chat handles the Back link. The SDK does not navigate the host automatically.
49
79
  Themes accept only `accent`, `background`, `surface`, `text`, `font`, `radius`, `scheme`.
50
80
  Colours are opaque hex; font is system/sans/serif, radius is 0–16, scheme light/dark.
81
+ Omit `font` to keep Alyte's self-hosted Hanken Grotesk. Explicit `system`, `sans` and
82
+ `serif` select system UI, Arial and Georgia respectively. Secondary text and dividers
83
+ are derived automatically from the palette while preserving readable contrast.
51
84
  If contrast fails, all four colours fall back to scheme defaults; they are not
52
85
  adjusted. Permission terms, errors and disabled controls keep fixed readable colours.
53
86
  Provider card inputs keep their provider styling.
@@ -77,7 +110,7 @@ Other methods: `me()`, `catalog()`, `agents()`, `instruments()`, `instrumentCaps
77
110
  `watches()`, `watch({ agentId, tierId, quantity, expiresInDays? })`,
78
111
  `cancelWatch(id)`, `revokeMandate(id)`. Revocation is immediate and server-enforced.
79
112
  Every buy/watch still depends on the buyer's current mandate, card evidence and
80
- live availability. A bounded bearer cannot create or widen spending authority.
113
+ live availability. An ordinary bounded bearer cannot create or widen spending authority.
81
114
 
82
115
  Your backend still fulfills from verified settlement webhooks, idempotently.
83
116
  Browser completion messages are presentation state, not fulfillment evidence.
package/QUICKSTART.md CHANGED
@@ -4,7 +4,7 @@ Choose the credential for the runtime:
4
4
 
5
5
  | Client | Credential | Runs | Does |
6
6
  |---|---|---|---|
7
- | `AlyteMerchant` | API token (console → API keys, `merchant:read`/`merchant:write`) | **your server only** | catalog CRUD, PSP links, payments visibility, buyer-session mint |
7
+ | `AlyteMerchant` | API token (console → API keys, `merchant:read`/`merchant:write`; `merchant:admin` for creating or deleting shops and linking a PSP) | **your server only** | catalog CRUD, PSP links, payments visibility, buyer-session mint |
8
8
  | `AlyteAgent` | agent JWT | your agent runtime | discover → quote → hold → confirm |
9
9
  | `@alytegen/sdk/browser` | bounded buyer bearer | your chat page | embedded consent and purchases using the buyer's Alyte agent |
10
10
 
@@ -45,6 +45,10 @@ const s = await alyte.buyerSessions.mint({
45
45
  res.redirect(ALYTE_URL + s.redeemPath); // single-use, 15-min TTL
46
46
  ```
47
47
 
48
+ Merchants that Alyte staff have enabled under contract can mint with `merchantAttested: true`
49
+ on a key holding only `mandates:attest`: the buyer then creates a permission within your
50
+ shop's ceilings without the emailed code (see the README's hand-off section).
51
+
48
52
  Embedding in a chat? Follow [BROWSER.md](./BROWSER.md) to exchange the single-use
49
53
  token and launch consent without third-party cookies. Directly framing the full
50
54
  authorize page is also supported, but its cookie session depends on browser policy.
package/README.md CHANGED
@@ -23,7 +23,7 @@ npm install @alytegen/sdk
23
23
  | `createWebhookHandler` / `verifyWebhookSignature` | webhook secret | your server | signed, at-least-once purchase events with typed dispatch |
24
24
  | `exchangeBuyerSession` / `createBuyerClient` / `openConsent` from `@alytegen/sdk/browser` | bounded buyer bearer | partner browser/chat | isolated consent, then buy/watch/list/revoke within existing authority |
25
25
 
26
- The browser entry is new in 0.4.0. See [the chat integration](./BROWSER.md) for setup,
26
+ The browser entry arrived in 0.4.0; 0.6.0 is the current release. See [the chat integration](./BROWSER.md) for setup,
27
27
  cookie-independent consent, reconnecting and handling uncertain purchases.
28
28
 
29
29
  ## Merchant: onboard in four calls
@@ -43,6 +43,54 @@ const { event } = await alyte.createEvent({ merchantId: merchant.id, title: 'War
43
43
  const { tier } = await alyte.createTier({ eventId: event.id, title: 'GA', priceMinor: 4900, currency: 'EUR', kind: 'general', availableCount: 500 });
44
44
  ```
45
45
 
46
+ ## Inventory management
47
+
48
+ Available since SDK 0.6.0.
49
+
50
+ The merchant can operate the venue and own its inventory. One API credential with
51
+ `merchant:read` and `merchant:write` manages both. A location is optional place and
52
+ time-zone metadata under the shop, not a separate account.
53
+
54
+ ```ts
55
+ const { location } = await alyte.createLocation(merchant.id, {
56
+ name: 'Our theatre', timeZone: 'Europe/London',
57
+ });
58
+ const { event: show } = await alyte.createEvent({
59
+ merchantId: merchant.id, title: 'Evening show', startsAt: '2027-05-01T20:00:00+01:00',
60
+ location: { id: location.id, expectedRevision: location.revision }, // optional
61
+ });
62
+ const { pool } = await alyte.createPool({
63
+ merchantId: merchant.id, eventId: show.id, title: 'General admission', capacity: 100,
64
+ });
65
+ await alyte.createTier({
66
+ eventId: show.id, title: 'Adult', kind: 'general', priceMinor: 2500, currency: 'EUR', poolId: pool.id,
67
+ });
68
+ await alyte.createTier({
69
+ eventId: show.id, title: 'Child', kind: 'general', priceMinor: 1500, currency: 'EUR', poolId: pool.id,
70
+ });
71
+ const { catalog: observation } = await alyte.inventoryCatalog(merchant.id);
72
+ // Both prices draw from one counter. The observation is not a reservation or quote.
73
+ ```
74
+
75
+ Use `listPools` and `updatePool` to inspect or edit shared capacity. `availableCount`
76
+ sets remaining stock; it is not an increment. Omit it when only renaming a pool.
77
+ Pooled tiers cannot be restocked individually, and the server refuses capacity below
78
+ outstanding holds. `updateTier` still controls price, sale windows and sellability.
79
+
80
+ `listLocations`, `updateLocation`, `getSlot` and `setSlotLocation` manage optional
81
+ place metadata. Location changes require the revision you read. Existing occurrences
82
+ keep their pinned location version until explicitly rebound. Rebinding or clearing
83
+ a location does not reschedule the event. Pass `expectedOccurrenceRevision` to
84
+ `updateTier` when a sale-window edit depends on the slot's location; stale edits
85
+ return `commerce_schedule_conflict` and should be refreshed before retrying.
86
+
87
+ `inventoryCatalog` reports current base prices and stock, with no private buyer or
88
+ agent allow-lists. Its disabled generic transaction capabilities describe that
89
+ observation; they do not disable the merchant's stock-management methods. It fails
90
+ with `catalog_too_large` if any source relation exceeds 2,000 rows, including private
91
+ eligibility rows. `listLocations` has a separate 2,000-row bound. Neither returns a
92
+ truncated result.
93
+
46
94
  ## Hand a signed-in customer to their agent
47
95
 
48
96
  Your users already have accounts with you. Your server attests one of them and redirects;
@@ -54,6 +102,25 @@ const s = await alyte.buyerSessions.mint({ merchantId: merchant.id, email: user.
54
102
  res.redirect(ALYTE_URL + s.redeemPath); // single-use, 15-minute link
55
103
  ```
56
104
 
105
+ Two kinds of session, decided by how you mint:
106
+
107
+ - **Ordinary** (above): the buyer can act inside permission they already granted. Creating or
108
+ widening permission asks them to confirm a 6-digit code Alyte emails them, typed into Alyte's
109
+ own screen — never into yours.
110
+ - **Merchant-attested** — for merchants Alyte staff have enabled under contract — lets the buyer
111
+ create a permission **without the code**, within the ceilings staff set for your shop, because
112
+ you vouch for your signed-in, email-verified customer. It needs a key holding only
113
+ `mandates:attest` (the console offers **attest verified customers only** once enabled):
114
+
115
+ ```ts
116
+ const attesting = new AlyteMerchant({ baseUrl: ALYTE_URL, token: process.env.ALYTE_ATTEST_KEY! });
117
+ const s = await attesting.buyerSessions.mint({ merchantId: merchant.id, email: user.email, merchantAttested: true });
118
+ ```
119
+
120
+ The buyer sees "Set up by {your shop}" on that agent and can revoke it. A grant outside the
121
+ ceilings answers `403 merchant_consent_ceiling_exceeded` and Alyte's screen falls back to the
122
+ buyer's own code; without the enablement, the mint answers `403 merchant_consent_not_enabled`.
123
+
57
124
  ## Receive purchases
58
125
 
59
126
  ```ts
@@ -82,6 +149,22 @@ const out = await agent.confirm(hold.id,
82
149
  No amount is passed at confirm — the charge is the locked quote. A spend-cap refusal means
83
150
  the buyer's mandate said no: surface it, don't retry.
84
151
 
152
+ ## Current API and console capabilities
153
+
154
+ SDK **0.6.0** adds inventory management: shared pools (`createPool`, `listPools`, `updatePool`),
155
+ optional venue locations with pinned versions (`createLocation`, `listLocations`, `updateLocation`,
156
+ `getSlot`, `setSlotLocation`, `createEvent({ location })`) and a read-only `inventoryCatalog`
157
+ observation. **0.5.0** typed the merchant-attested mint (`merchantAttested: true`), alongside the browser
158
+ entry point and the typed tier-create restrictions (`onSaleStart`, `onSaleEnd`, `maxQtyPerPurchase`,
159
+ `sellable`, `allowedGeos`, `allowedSchemes` — put them in the initial `createTier` call so a
160
+ scheduled tier is never briefly on sale).
161
+
162
+ The console offers **attest verified customers only** while Alyte staff have enabled contracted
163
+ consent for your organization; that key holds only `mandates:attest`, and a read/write key does
164
+ not include it. Permission creation for everyone else goes through Alyte's consent screen with the
165
+ emailed code — there is no API for your code to create or widen a buyer's spending authority, by
166
+ design. Alyte's server runs Node 22; this SDK supports Node 18 and later.
167
+
85
168
  ## Learn more
86
169
 
87
170
  - [QUICKSTART.md](./QUICKSTART.md) — the walkthrough with every call explained.
package/dist/browser.d.ts CHANGED
@@ -54,7 +54,7 @@ export interface BuyerWatch {
54
54
  merchantId: string;
55
55
  tierId: string;
56
56
  quantity: number;
57
- status: 'queued' | 'firing' | 'fired' | 'failed' | 'cancelled' | 'expired';
57
+ status: 'queued' | 'paused' | 'firing' | 'fired' | 'failed' | 'cancelled' | 'expired';
58
58
  result?: Record<string, unknown>;
59
59
  expiresAt?: string;
60
60
  createdAt: string;
package/dist/http.d.ts CHANGED
@@ -19,5 +19,5 @@ export declare class Transport {
19
19
  private readonly token;
20
20
  private readonly fetchImpl;
21
21
  constructor(opts: ClientOptions);
22
- request<T>(method: 'GET' | 'POST' | 'PATCH' | 'DELETE', path: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
22
+ request<T>(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', path: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
23
23
  }
@@ -0,0 +1,142 @@
1
+ import type { FeeBearer, Scheme, TierKind } from './types.js';
2
+ /** One capacity counter shared by the merchant's offers. */
3
+ export interface InventoryPool {
4
+ id: string;
5
+ tenantId: string;
6
+ merchantId: string;
7
+ eventId?: string;
8
+ title: string;
9
+ capacity: number;
10
+ availableCount: number;
11
+ authority: 'local';
12
+ createdAt: string;
13
+ }
14
+ /** Optional place metadata owned by a shop, not another merchant or account. */
15
+ export interface InventoryLocation {
16
+ tenantId: string;
17
+ storeId: string;
18
+ id: string;
19
+ revision: number;
20
+ name: string;
21
+ timeZone: string;
22
+ }
23
+ export interface InventoryOccurrence {
24
+ tenantId: string;
25
+ storeId: string;
26
+ id: string;
27
+ kind: 'occurrence';
28
+ source: 'native' | 'ticketing';
29
+ startsAt: string;
30
+ endsAt: string | null;
31
+ /** Versions the location binding, not the event's schedule. */
32
+ metadataRevision: number;
33
+ location: InventoryLocation | null;
34
+ }
35
+ export type InventoryLocationBinding = {
36
+ locationId: string;
37
+ expectedRevision: number;
38
+ expectedLocationRevision: number;
39
+ } | {
40
+ locationId: null;
41
+ expectedRevision: number;
42
+ expectedLocationRevision?: never;
43
+ };
44
+ export interface InventoryRef<K extends string> {
45
+ kind: K;
46
+ id: string;
47
+ tenantId: string;
48
+ storeId: string;
49
+ }
50
+ export type InventorySourceRef = InventoryRef<'ticketing.tier_counter' | 'ticketing.pool' | 'ticketing.seat_set'>;
51
+ /** Current stock/price observation, not a quote, reservation or authorization.
52
+ * The merchant can still manage its inventory through the write methods. */
53
+ export interface InventoryCatalog {
54
+ schemaVersion: 1;
55
+ profile: 'ticketing';
56
+ use: 'inventory_observation';
57
+ tenantId: string;
58
+ storeId: string;
59
+ observedAt: string;
60
+ storePolicy: {
61
+ geo: string;
62
+ currency: string;
63
+ allowedSchemes?: Scheme[];
64
+ feeBearer: FeeBearer;
65
+ taxRateBps: number;
66
+ };
67
+ checkout: {
68
+ mode: 'api' | 'hosted';
69
+ url: string | null;
70
+ };
71
+ /** Generic transaction operations are not implemented. These are not token permissions. */
72
+ capabilities: {
73
+ reserve: false;
74
+ quote: false;
75
+ purchase: false;
76
+ };
77
+ products: Array<{
78
+ ref: InventoryRef<'product'>;
79
+ title: string;
80
+ }>;
81
+ variants: Array<{
82
+ ref: InventoryRef<'variant'>;
83
+ product: InventoryRef<'product'>;
84
+ title: string;
85
+ }>;
86
+ slots: Array<{
87
+ ref: InventoryRef<'slot'>;
88
+ startsAt: string;
89
+ endsAt: string | null;
90
+ timeZone: string | null;
91
+ metadataRevision: number | null;
92
+ location: (InventoryRef<'location'> & {
93
+ revision: number;
94
+ name: string;
95
+ }) | null;
96
+ }>;
97
+ offers: Array<{
98
+ ref: InventoryRef<'offer'>;
99
+ variant: InventoryRef<'variant'>;
100
+ slot: InventoryRef<'slot'>;
101
+ title: string;
102
+ /** Base unit price only; tax/processing fees are resolved by the quote path. */
103
+ price: {
104
+ kind: 'unit_base';
105
+ amountMinor: number;
106
+ currency: string;
107
+ };
108
+ termsVersion: null;
109
+ sellable: boolean;
110
+ quantity: {
111
+ unit: 'item' | 'admission_place';
112
+ maxPerPurchase?: number;
113
+ };
114
+ salesWindow: {
115
+ start?: string;
116
+ end?: string;
117
+ startInclusive: boolean;
118
+ endInclusive: boolean;
119
+ };
120
+ eligibility: {
121
+ principalRestricted: boolean;
122
+ geos?: string[];
123
+ schemes?: Scheme[];
124
+ };
125
+ inventory: {
126
+ source: InventorySourceRef;
127
+ unitsPerItem: number;
128
+ };
129
+ profile: {
130
+ tierKind: TierKind;
131
+ };
132
+ }>;
133
+ inventory: Array<{
134
+ ref: InventorySourceRef;
135
+ availability: {
136
+ state: 'observed';
137
+ units: number;
138
+ } | {
139
+ state: 'unknown';
140
+ };
141
+ }>;
142
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,9 @@
1
1
  import { type ClientOptions } from './http.js';
2
- import type { BuyerSessionMint, CatalogMerchant, Merchant, EventItem, MerchantPspLink, Tier, TierKind, FeeBearer, Scheme, PaymentRow, WebhookEndpoint, MerchantInsights } from './types.js';
2
+ import type { BuyerSessionMint, CatalogMerchant, Merchant, EventItem, MerchantPspLink, Tier, TierKind, FeeBearer, Scheme, PaymentRow, WebhookEndpoint, MerchantInsights, InventoryCatalog, InventoryLocation, InventoryLocationBinding, InventoryOccurrence, InventoryPool } from './types.js';
3
3
  /**
4
4
  * Merchant integration client — drives the `/v1/integration/*` surface with a
5
- * console-minted API token (`merchant:read` / `merchant:write` scopes).
5
+ * console-minted API token (`merchant:read` / `merchant:write` scopes; `merchant:admin` for
6
+ * creating or deleting shops and linking a PSP — the "full" console preset).
6
7
  *
7
8
  * SERVER-SIDE ONLY: the API token is a secret. Never ship it to a browser.
8
9
  *
@@ -43,10 +44,15 @@ export declare class AlyteMerchant {
43
44
  }): Promise<{
44
45
  merchant: Merchant;
45
46
  }>;
47
+ /** Optional location is metadata owned by this shop; the merchant may operate it. */
46
48
  createEvent(input: {
47
49
  merchantId: string;
48
50
  title: string;
49
51
  startsAt: string;
52
+ location?: {
53
+ id: string;
54
+ expectedRevision: number;
55
+ };
50
56
  }): Promise<{
51
57
  event: EventItem;
52
58
  }>;
@@ -58,6 +64,8 @@ export declare class AlyteMerchant {
58
64
  currency: string;
59
65
  kind: TierKind;
60
66
  availableCount?: number;
67
+ /** Shared counter; omit availableCount when attaching a pool. */
68
+ poolId?: string | null;
61
69
  maxQtyPerPurchase?: number | null;
62
70
  sellable?: boolean;
63
71
  onSaleStart?: string | null;
@@ -70,6 +78,9 @@ export declare class AlyteMerchant {
70
78
  updateTier(tierId: string, patch: {
71
79
  priceMinor?: number;
72
80
  availableCount?: number;
81
+ poolId?: string | null;
82
+ /** Guard sale-window edits against a concurrent location-binding change. */
83
+ expectedOccurrenceRevision?: number;
73
84
  maxQtyPerPurchase?: number | null;
74
85
  sellable?: boolean;
75
86
  onSaleStart?: string | null;
@@ -85,6 +96,55 @@ export declare class AlyteMerchant {
85
96
  deleteEvent(eventId: string): Promise<{
86
97
  ok: boolean;
87
98
  }>;
99
+ /** Observed stock and base prices for one shop; not a reserved or quoted offer.
100
+ * Read scope does not grant writes. A read/write key can also manage this inventory.
101
+ * Fails with catalog_too_large if any source relation exceeds 2,000 rows. */
102
+ inventoryCatalog(merchantId: string): Promise<{
103
+ catalog: InventoryCatalog;
104
+ }>;
105
+ listLocations(merchantId: string): Promise<{
106
+ locations: InventoryLocation[];
107
+ }>;
108
+ createLocation(merchantId: string, input: {
109
+ name: string;
110
+ timeZone: string;
111
+ }): Promise<{
112
+ location: InventoryLocation;
113
+ }>;
114
+ /** Existing occurrences keep their pinned version until explicitly rebound. */
115
+ updateLocation(merchantId: string, locationId: string, input: {
116
+ name: string;
117
+ timeZone: string;
118
+ expectedRevision: number;
119
+ }): Promise<{
120
+ location: InventoryLocation;
121
+ }>;
122
+ getSlot(merchantId: string, slotId: string): Promise<{
123
+ slot: InventoryOccurrence;
124
+ }>;
125
+ /** Metadata only; does not change the occurrence's start instant or inventory. */
126
+ setSlotLocation(merchantId: string, slotId: string, input: InventoryLocationBinding): Promise<{
127
+ slot: InventoryOccurrence;
128
+ }>;
129
+ createPool(input: {
130
+ merchantId: string;
131
+ eventId?: string | null;
132
+ title: string;
133
+ capacity: number;
134
+ }): Promise<{
135
+ pool: InventoryPool;
136
+ }>;
137
+ listPools(merchantId: string): Promise<{
138
+ pools: InventoryPool[];
139
+ }>;
140
+ /** availableCount sets remaining units, not an increment; capacity must cover holds. */
141
+ updatePool(poolId: string, patch: {
142
+ title?: string;
143
+ capacity?: number;
144
+ availableCount?: number;
145
+ }): Promise<{
146
+ pool: InventoryPool;
147
+ }>;
88
148
  listPsps(merchantId: string): Promise<{
89
149
  psps: MerchantPspLink[];
90
150
  }>;
@@ -166,6 +226,11 @@ export declare class AlyteMerchant {
166
226
  /** The buyer's language on YOUR site (BCP-47, e.g. "de" or "de-AT"), so Alyte's
167
227
  * pages open in the same language. Presentation only. */
168
228
  lang?: string;
229
+ /** Attest this customer's consent yourself: the session may then create a permission
230
+ * without Alyte's emailed code, within your account's limits. Requires a key with the
231
+ * `mandates:attest` scope and merchant-attested consent enabled for your account by Alyte
232
+ * (a contract is in place). The permission records that YOU attested it. */
233
+ merchantAttested?: true;
169
234
  }) => Promise<BuyerSessionMint>;
170
235
  };
171
236
  }
package/dist/merchant.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Transport } from './http.js';
2
2
  /**
3
3
  * Merchant integration client — drives the `/v1/integration/*` surface with a
4
- * console-minted API token (`merchant:read` / `merchant:write` scopes).
4
+ * console-minted API token (`merchant:read` / `merchant:write` scopes; `merchant:admin` for
5
+ * creating or deleting shops and linking a PSP — the "full" console preset).
5
6
  *
6
7
  * SERVER-SIDE ONLY: the API token is a secret. Never ship it to a browser.
7
8
  *
@@ -31,6 +32,7 @@ export class AlyteMerchant {
31
32
  updateShopDiscovery(merchantId, input) {
32
33
  return this.t.request('PATCH', `/v1/integration/merchants/${encodeURIComponent(merchantId)}`, input);
33
34
  }
35
+ /** Optional location is metadata owned by this shop; the merchant may operate it. */
34
36
  createEvent(input) {
35
37
  return this.t.request('POST', '/v1/integration/events', input);
36
38
  }
@@ -47,6 +49,39 @@ export class AlyteMerchant {
47
49
  deleteEvent(eventId) {
48
50
  return this.t.request('DELETE', `/v1/integration/events/${encodeURIComponent(eventId)}`);
49
51
  }
52
+ /** Observed stock and base prices for one shop; not a reserved or quoted offer.
53
+ * Read scope does not grant writes. A read/write key can also manage this inventory.
54
+ * Fails with catalog_too_large if any source relation exceeds 2,000 rows. */
55
+ inventoryCatalog(merchantId) {
56
+ return this.t.request('GET', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/inventory`);
57
+ }
58
+ listLocations(merchantId) {
59
+ return this.t.request('GET', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/locations`);
60
+ }
61
+ createLocation(merchantId, input) {
62
+ return this.t.request('POST', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/locations`, input);
63
+ }
64
+ /** Existing occurrences keep their pinned version until explicitly rebound. */
65
+ updateLocation(merchantId, locationId, input) {
66
+ return this.t.request('PATCH', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/locations/${encodeURIComponent(locationId)}`, input);
67
+ }
68
+ getSlot(merchantId, slotId) {
69
+ return this.t.request('GET', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/slots/${encodeURIComponent(slotId)}`);
70
+ }
71
+ /** Metadata only; does not change the occurrence's start instant or inventory. */
72
+ setSlotLocation(merchantId, slotId, input) {
73
+ return this.t.request('PUT', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/slots/${encodeURIComponent(slotId)}/location`, input);
74
+ }
75
+ createPool(input) {
76
+ return this.t.request('POST', '/v1/integration/pools', input);
77
+ }
78
+ listPools(merchantId) {
79
+ return this.t.request('GET', `/v1/integration/pools?merchantId=${encodeURIComponent(merchantId)}`);
80
+ }
81
+ /** availableCount sets remaining units, not an increment; capacity must cover holds. */
82
+ updatePool(poolId, patch) {
83
+ return this.t.request('PATCH', `/v1/integration/pools/${encodeURIComponent(poolId)}`, patch);
84
+ }
50
85
  listPsps(merchantId) {
51
86
  return this.t.request('GET', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/psps`);
52
87
  }
package/dist/types.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  export type Scheme = 'visa' | 'mastercard' | 'amex';
6
6
  export type TierKind = 'general' | 'seated';
7
7
  export type FeeBearer = 'buyer' | 'merchant';
8
+ export type * from './inventoryTypes.js';
8
9
  export interface Merchant {
9
10
  id: string;
10
11
  name: string;
@@ -19,7 +20,7 @@ export interface Merchant {
19
20
  /** Public discovery opt-in (default false) — see AlyteMerchant.updateShopDiscovery. */
20
21
  discoverable?: boolean;
21
22
  imageUrl?: string;
22
- /** The ONE partner origin allowed to embed the authorize page (G14). */
23
+ /** Up to three partner origins (space- or comma-separated) allowed to embed the authorize page and call the buyer API from a browser (G14, L2). */
23
24
  embedOrigin?: string;
24
25
  }
25
26
  export interface EventItem {
@@ -38,6 +39,8 @@ export interface Tier {
38
39
  currency: string;
39
40
  kind: TierKind;
40
41
  availableCount?: number;
42
+ /** When present, availability comes from this shared pool. Restock the pool. */
43
+ poolId?: string;
41
44
  maxQtyPerPurchase?: number;
42
45
  sellable?: boolean;
43
46
  onSaleStart?: string;
@@ -180,6 +183,7 @@ export interface MerchantInsights {
180
183
  tierTitle: string;
181
184
  eventTitle: string;
182
185
  queued: number;
186
+ paused: number;
183
187
  fired: number;
184
188
  failed: number;
185
189
  cancelled: number;
@@ -2,7 +2,7 @@
2
2
  * Merchant onboarding, end to end: shop → PSP → event → tier → your user shopping.
3
3
  *
4
4
  * ALYTE_BASE_URL=https://alyte-sandbox-….run.app \
5
- * ALYTE_API_TOKEN=<console-minted, merchant:read+merchant:write> \
5
+ * ALYTE_API_TOKEN=<console-minted, the "full" preset: merchant:read+merchant:write+merchant:admin> \
6
6
  * npx tsx merchant-onboard.ts
7
7
  */
8
8
  import { AlyteMerchant } from '@alytegen/sdk';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alytegen/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Alyte client SDK \u2014 merchant integration (catalog, PSP links, buyer sessions, payments visibility) and the agent buy path (discover \u2192 quote \u2192 hold \u2192 confirm).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",