From b679337f1d0f552ff6c2230b0a7606fd29113918 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Wed, 6 May 2026 09:38:46 +0100 Subject: [PATCH 1/6] feat: add shopper_attributes and admin_attributes on products --- src/types/pcm.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/types/pcm.d.ts b/src/types/pcm.d.ts index b073d2e..cb79fdf 100644 --- a/src/types/pcm.d.ts +++ b/src/types/pcm.d.ts @@ -41,6 +41,8 @@ export interface PcmProductBase extends PcmProductRelationships { components?: ProductComponents custom_inputs?: CustomInputs tags?: string[] + admin_attributes?: { [key: string]: string } + shopper_attributes?: { [key: string]: string } } } From 88bbafd4d59dd6288a2cc9f06b524cab8c3dc117 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Wed, 6 May 2026 09:38:58 +0100 Subject: [PATCH 2/6] feat: add per-option min and max on bundle component options --- src/types/pcm.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/types/pcm.d.ts b/src/types/pcm.d.ts index cb79fdf..9e505ba 100644 --- a/src/types/pcm.d.ts +++ b/src/types/pcm.d.ts @@ -88,6 +88,8 @@ export interface ProductComponentOption { id: string quantity: number type: string + min?: number | null + max?: number | null sort_order?: number | null default?: boolean meta: { From d5de1e3a1630d5bf066dc190260695a8f7fd1be4 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Wed, 6 May 2026 09:39:32 +0100 Subject: [PATCH 3/6] feat: add catalog rule validation endpoint and pricebook_ids filter --- src/endpoints/catalogs.js | 14 ++++++++ src/types/catalogs-rules.d.ts | 65 ++++++++++++++++++++++++++++++++--- 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/src/endpoints/catalogs.js b/src/endpoints/catalogs.js index 47e2045..e12be3e 100644 --- a/src/endpoints/catalogs.js +++ b/src/endpoints/catalogs.js @@ -348,6 +348,20 @@ class Rules extends CRUDExtend { token ) } + + Validate(body, token = null) { + const { limit, offset } = this + + return this.request.send( + buildURL(`catalogs/${this.endpoint}/validate`, { + limit, + offset + }), + 'POST', + body, + token + ) + } } class CatalogsEndpoint extends CRUDExtend { diff --git a/src/types/catalogs-rules.d.ts b/src/types/catalogs-rules.d.ts index ec43113..7f66347 100644 --- a/src/types/catalogs-rules.d.ts +++ b/src/types/catalogs-rules.d.ts @@ -4,7 +4,9 @@ */ import { Identifiable, - CrudQueryableResource + CrudQueryableResource, + Resource, + ResourcePage } from './core' /** @@ -21,6 +23,7 @@ export interface RuleBase { customer_ids?: string[] channels?: string[] tags?: string[] + pricebook_ids?: string[] schedules?: {valid_from: string, valid_to: string}[] } } @@ -33,8 +36,19 @@ export interface Rule extends Identifiable, RuleBase { // Do Not have any relationships yet //TODO +export interface RuleFilterAttributes { + id?: string + catalog_id?: string + account_ids?: string + customer_ids?: string + channels?: string + tags?: string + pricebook_ids?: string +} + export interface RuleFilter { -// TODO + eq?: RuleFilterAttributes + in?: Pick } type RuleSort = // TODO @@ -47,10 +61,53 @@ export interface RuleUpdateBody extends RuleBase { id: string } +export type RuleValidationMatchType = + | 'filter' + | 'similarity' + | 'conflict' + | 'resolve_for_shopper' + +export interface RuleValidationCriteria { + channels?: string[] + tags?: string[] + account_ids?: string[] + account_tag_ids?: string[] + customer_ids?: string[] +} + +export interface CatalogRuleValidatorRequest { + data: { + type: 'catalog_rule_validator' + match_type: RuleValidationMatchType + catalog_id?: string + pricebook_ids?: string[] + schedules?: { valid_from: string; valid_to: string }[] + attributes?: RuleValidationCriteria + } +} + +export interface RuleMeta { + similarity_score?: number + active?: boolean + resolved_for_shopper?: boolean + release_id?: string +} + +export interface ValidatedRule extends Rule { + meta?: RuleMeta +} + +export type ValidateRulesResponse = ResourcePage + export interface CatalogsRulesEndpoint extends CrudQueryableResource { endpoint: 'rules' id: string -} - + /** + * Validate Catalog Rules + * @param body - validation request describing the match_type and rule criteria. + * @param token - optional customer token. + */ + Validate(body: CatalogRuleValidatorRequest, token?: string): Promise +} From cd57328789d719810e30b72f7b1f37ed23562aa5 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Wed, 6 May 2026 09:40:03 +0100 Subject: [PATCH 4/6] feat: add pricebook segmentation fields on product response --- src/types/catalogs-products.d.ts | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/types/catalogs-products.d.ts b/src/types/catalogs-products.d.ts index b9caeb4..500863f 100644 --- a/src/types/catalogs-products.d.ts +++ b/src/types/catalogs-products.d.ts @@ -9,6 +9,44 @@ export interface CatalogsProductVariation options: Omit[] } +export interface PriceTier { + minimum_quantity: number + amount: { + [currency: string]: { + amount: number + includes_tax: boolean + } + } +} + +export interface AvailablePrice { + pricebook_id: string + shopper_attributes?: { [key: string]: string } + sale_id?: string + sale_expires?: string + price?: { + [currency: string]: { + amount: number + includes_tax: boolean + } + } + tiers?: { [tier: string]: PriceTier } +} + +export interface AlternativePrice extends AvailablePrice { + name: string + display_price?: { + without_tax?: FormattedPrice + with_tax?: FormattedPrice + } + original_price?: { + [currency: string]: { + amount: number + includes_tax: boolean + } + } +} + export interface ProductResponse extends Identifiable { type: 'product' attributes: { @@ -38,6 +76,9 @@ export interface ProductResponse extends Identifiable { weight: string manufacturer_part_num?: string extensions?: Extensions + available_prices?: AvailablePrice[] + alternative_prices?: { [name: string]: AlternativePrice } + available_pricebook_ids?: string[] } meta: { catalog_id?: string @@ -76,6 +117,7 @@ export interface ProductResponse extends Identifiable { } } pricebook_id: string + alternative_prices?: { [name: string]: AlternativePrice } } } } From 52256e520fabfff19eaba5e48c686ec87197310a Mon Sep 17 00:00:00 2001 From: Robert Field Date: Wed, 6 May 2026 09:40:14 +0100 Subject: [PATCH 5/6] feat: add release indexing complete data type --- src/types/catalogs-releases.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/types/catalogs-releases.d.ts b/src/types/catalogs-releases.d.ts index 32360fa..bde279e 100644 --- a/src/types/catalogs-releases.d.ts +++ b/src/types/catalogs-releases.d.ts @@ -22,6 +22,14 @@ export interface ReleaseBodyBase { export_full_delta?: boolean } +export type ReleaseIndexingStatus = 'succeeded' | 'failed' + +export interface ReleaseIndexingCompleteData { + data: { + status: ReleaseIndexingStatus + } +} + export interface CatalogsReleasesEndpoint { endpoint: 'releases' From 0e63d78f531597ead55d924f94bf806949e247a3 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Wed, 6 May 2026 09:40:36 +0100 Subject: [PATCH 6/6] feat: add columns option to product export --- src/endpoints/pcm.js | 9 +++++++-- src/types/pcm.d.ts | 14 +++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/endpoints/pcm.js b/src/endpoints/pcm.js index 433e7c1..e16b475 100644 --- a/src/endpoints/pcm.js +++ b/src/endpoints/pcm.js @@ -64,13 +64,18 @@ class PCMEndpoint extends CRUDExtend { return this.request.send(`${this.endpoint}/detach_nodes`, 'POST', body) } - ExportProducts(filter, useTemplateSlugs) { + ExportProducts(filter, useTemplateSlugs, columns) { + const body = columns + ? { data: { type: 'product', attributes: { columns } } } + : undefined + return this.request.send( buildURL(`${this.endpoint}/export`, { filter, useTemplateSlugs }), - 'POST' + 'POST', + body ) } } diff --git a/src/types/pcm.d.ts b/src/types/pcm.d.ts index 9e505ba..ef3c5b2 100644 --- a/src/types/pcm.d.ts +++ b/src/types/pcm.d.ts @@ -259,7 +259,19 @@ export interface PcmProductsEndpoint /** * Export products * @param filter - products filters + * @param useTemplateSlugs - use template slugs instead of template IDs + * @param columns - select which columns to include in the exported CSV. Supports + * individual keys (e.g. `admin_attributes.cost_of_goods`) and wildcards + * (e.g. `admin_attributes.*`). * @constructor */ - ExportProducts(filter?: PcmProductFilter, useTemplateSlugs?: boolean): Promise> + ExportProducts( + filter?: PcmProductFilter, + useTemplateSlugs?: boolean, + columns?: PcmProductExportColumns + ): Promise> +} + +export interface PcmProductExportColumns { + include: string[] }