commerce-kit 0.46.0 → 0.48.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/README.md +34 -0
- package/dist/api-types.d.ts +359 -8
- package/dist/index.d.ts +33 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -69,6 +69,7 @@ const { data, meta } = await commerce.orderBrowse({
|
|
|
69
69
|
|
|
70
70
|
// Get single order
|
|
71
71
|
const order = await commerce.orderGet({ id: 'order_789' });
|
|
72
|
+
// Orders with event-ticket lines carry a buyer access code: order.ticketCode (string | null)
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
## Events
|
|
@@ -100,6 +101,34 @@ await commerce.eventUpdate({ idOrSlug: 'summer-fest' }, { capacity: 600, status:
|
|
|
100
101
|
const { attendees, totalTickets } = await commerce.eventAttendeesBrowse({ idOrSlug: 'summer-fest' });
|
|
101
102
|
```
|
|
102
103
|
|
|
104
|
+
## Tickets
|
|
105
|
+
|
|
106
|
+
No-login access to purchased event tickets. The buyer gets a 6-character access code on the
|
|
107
|
+
order (`order.ticketCode`, also in the confirmation email) and manages all attendee details
|
|
108
|
+
with it plus the purchase email. Each seat carries its own shareable `token` — a view-only
|
|
109
|
+
link for the attendee; attendee details can only be edited by the buyer.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// Buyer lookup: access code + purchase email.
|
|
113
|
+
// Returns null on any mismatch (the API answers a uniform 404).
|
|
114
|
+
const bundle = await commerce.ticketsGet({ code: 'K7M3PA', email: 'buyer@example.com' });
|
|
115
|
+
// bundle.lines[].event — startsAt, location, guestLabel, guest
|
|
116
|
+
// bundle.lines[].seats[] — { token, name, email } per ticket
|
|
117
|
+
|
|
118
|
+
// Buyer bulk-edit of attendee names/emails.
|
|
119
|
+
// Throws on mismatch (404) or when the order is cancelled/refunded (409).
|
|
120
|
+
const updated = await commerce.ticketsUpdate(
|
|
121
|
+
{ code: 'K7M3PA' },
|
|
122
|
+
{
|
|
123
|
+
email: 'buyer@example.com',
|
|
124
|
+
seats: [{ token: bundle.lines[0].seats[0].token, name: 'Ada Lovelace', email: null }],
|
|
125
|
+
},
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
// View-only attendee ticket by seat token (null for unknown tokens)
|
|
129
|
+
const ticket = await commerce.ticketAttendeeGet({ token: 'a1b2c3...' });
|
|
130
|
+
```
|
|
131
|
+
|
|
103
132
|
## Collections & Categories
|
|
104
133
|
|
|
105
134
|
Full CRUD for product collections, product categories, and blog categories. Mutations are
|
|
@@ -111,6 +140,11 @@ const collection = await commerce.collectionCreate({ name: 'Summer', filter: { t
|
|
|
111
140
|
await commerce.collectionUpdate({ idOrSlug: 'summer' }, { name: 'Summer 2026', active: false });
|
|
112
141
|
await commerce.collectionDelete({ idOrSlug: 'summer' }); // { ok: true, deleted: 1 }
|
|
113
142
|
|
|
143
|
+
// Group related collections under a free-form key and fetch them together
|
|
144
|
+
await commerce.collectionUpdate({ idOrSlug: 'floral' }, { group: 'fragrances' });
|
|
145
|
+
const fragrances = await commerce.collectionBrowse({ group: 'fragrances' });
|
|
146
|
+
await commerce.collectionUpdate({ idOrSlug: 'floral' }, { group: null }); // clear
|
|
147
|
+
|
|
114
148
|
// Categories — delete (create/update already supported)
|
|
115
149
|
await commerce.categoryUpdate({ idOrSlug: 'shoes' }, { name: 'Footwear' });
|
|
116
150
|
await commerce.categoryDelete({ idOrSlug: 'footwear' }); // 409 if still referenced by products
|