@agent-cards/commerce-sdk 0.20.0 → 0.21.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.
@@ -145,6 +145,8 @@ export interface BuyToolLink {
145
145
  shipsToYou?: 'yes' | 'no';
146
146
  /** On a product link: the note for a product that ranks down for where it ships, as on `BuyToolProduct.shipsNote`. */
147
147
  shipsNote?: string;
148
+ /** On a product link: the condition a store names for a listing that is not new, as on `BuyToolProduct.conditionLabel`. */
149
+ conditionLabel?: string;
148
150
  }
149
151
  /** A store the answer's reply presents to choose from. */
150
152
  export interface BuyToolStore {
@@ -199,6 +201,8 @@ export interface BuyToolProduct {
199
201
  shipsToYou?: 'yes' | 'no';
200
202
  /** A short note for a product that ranks down for where it ships ("ships from the UK", "price in £"). Absent when there is none. */
201
203
  shipsNote?: string;
204
+ /** The condition a store names for a listing that is not new (`Pre-owned – Good` on an eBay used listing); absent on a new product. */
205
+ conditionLabel?: string;
202
206
  /** Who sells or books it, where that is not the store it names (`via StubHub`); absent when Agentcard named none. */
203
207
  fulfilledBy?: BuyFulfilledBy;
204
208
  /** The shopper's size as the store's read found it (`men's 10.5 in stock`); absent when none was asked or read. */
package/dist/buy-tool.js CHANGED
@@ -251,7 +251,7 @@ export function productsOf(turn) {
251
251
  /** A product's card as `sendLink` hears it: the id the model reads and a pick takes, never the store page, which is `url`. A flight option has no page at a store: its card carries no url, and its productId picks it. */
252
252
  function productLink(product) {
253
253
  const productId = pickId(product);
254
- return { kind: 'product', url: product.url || null, title: product.name, price: productPrice(product), ...(productId ? { productId } : {}), action: product.action ?? 'buy', imageUrl: product.imageUrl, images: product.images ?? (product.imageUrl ? [product.imageUrl] : []), store: product.store ?? null, storeDomain: product.storeDomain ?? null, expiresAt: null, ...(product.availability ? { availability: product.availability } : {}), ...(product.fulfilledBy ? { fulfilledBy: product.fulfilledBy } : {}), ...(product.shipsToYou ? { shipsToYou: product.shipsToYou } : {}), ...(product.shipsNote ? { shipsNote: product.shipsNote } : {}), ...(product.shopperSize ? { shopperSize: product.shopperSize } : {}) };
254
+ return { kind: 'product', url: product.url || null, title: product.name, price: productPrice(product), ...(productId ? { productId } : {}), action: product.action ?? 'buy', imageUrl: product.imageUrl, images: product.images ?? (product.imageUrl ? [product.imageUrl] : []), store: product.store ?? null, storeDomain: product.storeDomain ?? null, expiresAt: null, ...(product.availability ? { availability: product.availability } : {}), ...(product.fulfilledBy ? { fulfilledBy: product.fulfilledBy } : {}), ...(product.shipsToYou ? { shipsToYou: product.shipsToYou } : {}), ...(product.shipsNote ? { shipsNote: product.shipsNote } : {}), ...(product.conditionLabel ? { conditionLabel: product.conditionLabel } : {}), ...(product.shopperSize ? { shopperSize: product.shopperSize } : {}) };
255
255
  }
256
256
  /** A host name: dot-separated labels of letters, digits and hyphens, ending in a letters-only top-level label. */
257
257
  const STORE_HOST = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
@@ -289,6 +289,7 @@ function productsOfCatalog(catalog) {
289
289
  ...(item.availability ? { availability: item.availability } : {}),
290
290
  ...(item.ships_to_you === 'yes' || item.ships_to_you === 'no' ? { shipsToYou: item.ships_to_you } : {}),
291
291
  ...(item.ships_note ? { shipsNote: item.ships_note } : {}),
292
+ ...(item.condition_label ? { conditionLabel: item.condition_label } : {}),
292
293
  ...(item.fulfilled_by ? { fulfilledBy: item.fulfilled_by } : {}),
293
294
  ...(item.shopper_size ? { shopperSize: item.shopper_size } : {}),
294
295
  }));
package/dist/client.d.ts CHANGED
@@ -566,6 +566,11 @@ export interface BuyCatalogItem {
566
566
  ships_to_you: 'yes' | 'no' | 'unknown';
567
567
  /** A short note for a product that ranks down for where it ships ("ships from the UK", "price in £"), or null. */
568
568
  ships_note: string | null;
569
+ /**
570
+ * The condition a store names for a listing that is not new, as the store words it, such as an eBay used listing's
571
+ * `Pre-owned – Good`. Absent on a new product and from an older API. Show it on the card beside the price.
572
+ */
573
+ condition_label?: string;
569
574
  /** Who sells or books the product, where that is not the store the card names (`booked with OpenTable`); absent when Agentcard named none. */
570
575
  fulfilled_by?: BuyFulfilledBy;
571
576
  /** The size the shopper named, as the store's read of this product found it (BuyCardSize); absent when none was asked or read. */
package/dist/client.js CHANGED
@@ -330,6 +330,7 @@ function catalogItemsOf(v) {
330
330
  ...availabilityField(i),
331
331
  ships_to_you: i.ships_to_you === 'yes' || i.ships_to_you === 'no' ? i.ships_to_you : 'unknown',
332
332
  ships_note: str(i.ships_note),
333
+ ...(str(i.condition_label) ? { condition_label: str(i.condition_label) } : {}),
333
334
  ...fulfilledByField(i),
334
335
  ...cardSizeField(i),
335
336
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-cards/commerce-sdk",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Give your agent one tool that buys for your shoppers at real stores, and post each purchase update Agentcard sends into the shopper's chat, over a connection your server opens or a webhook endpoint.",
5
5
  "homepage": "https://opencommerce.sh",
6
6
  "type": "module",