brainerce 1.49.0 → 1.51.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 +28 -4
- package/dist/index.d.mts +57 -2
- package/dist/index.d.ts +57 -2
- package/dist/index.js +52 -1
- package/dist/index.mjs +52 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1426,7 +1426,8 @@ const { brands } = await client.getBrands();
|
|
|
1426
1426
|
const { tags } = await client.getTags();
|
|
1427
1427
|
// [{ id: "tag_1", name: "Sale" }, ...]
|
|
1428
1428
|
|
|
1429
|
-
// Use in product filtering
|
|
1429
|
+
// Use in product filtering — pass the IDs from getTags()/getBrands(),
|
|
1430
|
+
// NOT the display names:
|
|
1430
1431
|
const { data } = await client.getProducts({
|
|
1431
1432
|
brands: ['brand_1'],
|
|
1432
1433
|
tags: ['tag_1'],
|
|
@@ -1449,12 +1450,12 @@ const response: PaginatedResponse<Product> = await client.getProducts({
|
|
|
1449
1450
|
limit: 12,
|
|
1450
1451
|
search: 'shirt', // Optional: search by name
|
|
1451
1452
|
categories: 'cat_id', // Optional: filter by category (includes subcategories)
|
|
1452
|
-
brands: ['brand_id'], // Optional: filter by
|
|
1453
|
-
tags: ['tag_id'], // Optional: filter by
|
|
1453
|
+
brands: ['brand_id'], // Optional: filter by brand IDs (from getBrands())
|
|
1454
|
+
tags: ['tag_id'], // Optional: filter by tag IDs (from getTags()) — NOT tag names
|
|
1454
1455
|
minPrice: 10, // Optional: minimum price
|
|
1455
1456
|
maxPrice: 100, // Optional: maximum price
|
|
1456
1457
|
metafields: { color: ['red', 'blue'] }, // Optional: filter by custom-field values
|
|
1457
|
-
sortBy: 'createdAt', // Optional: 'name' | '
|
|
1458
|
+
sortBy: 'createdAt', // Optional: 'name' | 'price' | 'createdAt'
|
|
1458
1459
|
sortOrder: 'desc', // Optional: 'asc' | 'desc'
|
|
1459
1460
|
});
|
|
1460
1461
|
|
|
@@ -1676,6 +1677,29 @@ definitions.forEach((def) => {
|
|
|
1676
1677
|
|
|
1677
1678
|
> **Note:** `metafields` may be empty if the store hasn't defined custom fields. Always use optional chaining (`product.metafields?.forEach`).
|
|
1678
1679
|
|
|
1680
|
+
**Faceted filtering with product counts.** Definitions the merchant marked
|
|
1681
|
+
`filterable: true` (types `SELECT` / `MULTI_SELECT` / `BOOLEAN`) can be
|
|
1682
|
+
rendered as storefront facets. `getMetafieldFilters()` returns each of them
|
|
1683
|
+
with per-value counts of distinct active products — so you can show
|
|
1684
|
+
"Color: red (12) / blue (3)" without one `getProducts` call per value:
|
|
1685
|
+
|
|
1686
|
+
```typescript
|
|
1687
|
+
import type { MetafieldFilter } from 'brainerce';
|
|
1688
|
+
|
|
1689
|
+
const { filters } = await client.getMetafieldFilters();
|
|
1690
|
+
// Optional: { locale: 'he' } localizes each filter's `name`.
|
|
1691
|
+
|
|
1692
|
+
filters.forEach((f: MetafieldFilter) => {
|
|
1693
|
+
// f.values: [{ value: 'red', count: 12 }, { value: 'blue', count: 3 }]
|
|
1694
|
+
// Zero-count enumValues entries are included (render them disabled).
|
|
1695
|
+
// MULTI_SELECT stored arrays are split per element; BOOLEAN buckets are
|
|
1696
|
+
// always 'true' / 'false'.
|
|
1697
|
+
});
|
|
1698
|
+
|
|
1699
|
+
// Apply a selection — f.key pairs with the metafields filter:
|
|
1700
|
+
const { data } = await client.getProducts({ metafields: { color: ['red'] } });
|
|
1701
|
+
```
|
|
1702
|
+
|
|
1679
1703
|
#### Product Customization Fields (Customer Input)
|
|
1680
1704
|
|
|
1681
1705
|
Some products allow customers to provide custom input (e.g., "What text to write on the cake?", "Upload your logo"). These are returned in the `customizationFields` array on the product response.
|
package/dist/index.d.mts
CHANGED
|
@@ -4660,6 +4660,38 @@ interface PublicMetafieldDefinition {
|
|
|
4660
4660
|
defaultValue?: string | null;
|
|
4661
4661
|
position: number;
|
|
4662
4662
|
}
|
|
4663
|
+
/**
|
|
4664
|
+
* One facet value bucket with the number of DISTINCT active products carrying
|
|
4665
|
+
* it. For MULTI_SELECT definitions the stored arrays are split — a product
|
|
4666
|
+
* holding `["a","b"]` counts once for `a` and once for `b`. BOOLEAN buckets
|
|
4667
|
+
* normalize to `'true'` / `'false'`. Declared `enumValues` are always present
|
|
4668
|
+
* (including zero-count entries, so the UI can render disabled options);
|
|
4669
|
+
* stray stored values outside `enumValues` are reported as-is.
|
|
4670
|
+
*/
|
|
4671
|
+
interface MetafieldFilterValue {
|
|
4672
|
+
value: string;
|
|
4673
|
+
count: number;
|
|
4674
|
+
}
|
|
4675
|
+
/**
|
|
4676
|
+
* A filterable metafield definition plus per-value product counts — one entry
|
|
4677
|
+
* per facet the storefront should render. Returned by
|
|
4678
|
+
* {@link BrainerceClient.getMetafieldFilters}. `name` is localized per the
|
|
4679
|
+
* request locale. Pair the `key` with
|
|
4680
|
+
* `getProducts({ metafields: { [key]: [value] } })`.
|
|
4681
|
+
*/
|
|
4682
|
+
interface MetafieldFilter {
|
|
4683
|
+
id: string;
|
|
4684
|
+
key: string;
|
|
4685
|
+
name: string;
|
|
4686
|
+
type: MetafieldType;
|
|
4687
|
+
/** Declared allowed values for SELECT / MULTI_SELECT fields (with optional swatch metadata). */
|
|
4688
|
+
enumValues: CustomizationFieldOption[];
|
|
4689
|
+
values: MetafieldFilterValue[];
|
|
4690
|
+
}
|
|
4691
|
+
/** Response of `GET /metafield-filters` (vibe-coded and storefront modes). */
|
|
4692
|
+
interface MetafieldFiltersResponse {
|
|
4693
|
+
filters: MetafieldFilter[];
|
|
4694
|
+
}
|
|
4663
4695
|
/**
|
|
4664
4696
|
* A single selectable option for a SELECT or MULTI_SELECT customization field.
|
|
4665
4697
|
* Legacy string-only `enumValues` arrays are automatically promoted to this shape.
|
|
@@ -10144,6 +10176,29 @@ declare class BrainerceClient {
|
|
|
10144
10176
|
getPublicMetafieldDefinitions(): Promise<{
|
|
10145
10177
|
definitions: PublicMetafieldDefinition[];
|
|
10146
10178
|
}>;
|
|
10179
|
+
/**
|
|
10180
|
+
* Get facet value counts for filterable metafield definitions — one entry
|
|
10181
|
+
* per definition the merchant marked `filterable: true` (types SELECT /
|
|
10182
|
+
* MULTI_SELECT / BOOLEAN), each with DISTINCT-product counts per value.
|
|
10183
|
+
* Powers faceted navigation ("Color: red (12) / blue (3)") without one
|
|
10184
|
+
* `getProducts` round trip per candidate value.
|
|
10185
|
+
*
|
|
10186
|
+
* Available in vibe-coded and storefront modes. On the vibe-coded surface
|
|
10187
|
+
* only definitions published to your connection are returned, and counts
|
|
10188
|
+
* reflect only products published to it.
|
|
10189
|
+
*
|
|
10190
|
+
* @example
|
|
10191
|
+
* ```typescript
|
|
10192
|
+
* const { filters } = await client.getMetafieldFilters();
|
|
10193
|
+
* for (const f of filters) {
|
|
10194
|
+
* // f.key pairs with getProducts({ metafields: { [f.key]: [value] } })
|
|
10195
|
+
* console.log(f.name, f.values); // [{ value: 'red', count: 12 }, ...]
|
|
10196
|
+
* }
|
|
10197
|
+
* ```
|
|
10198
|
+
*/
|
|
10199
|
+
getMetafieldFilters(params?: {
|
|
10200
|
+
locale?: string;
|
|
10201
|
+
}): Promise<MetafieldFiltersResponse>;
|
|
10147
10202
|
/**
|
|
10148
10203
|
* Get all metafield definitions for the store
|
|
10149
10204
|
* Requires Admin mode (apiKey)
|
|
@@ -10651,7 +10706,7 @@ declare class BrainerceError extends Error {
|
|
|
10651
10706
|
constructor(message: string, statusCode: number, details?: unknown);
|
|
10652
10707
|
}
|
|
10653
10708
|
|
|
10654
|
-
declare const SDK_VERSION = "1.
|
|
10709
|
+
declare const SDK_VERSION = "1.51.0";
|
|
10655
10710
|
|
|
10656
10711
|
/**
|
|
10657
10712
|
* Verify a webhook signature from Brainerce
|
|
@@ -10989,4 +11044,4 @@ interface CategorySitemapOptions {
|
|
|
10989
11044
|
*/
|
|
10990
11045
|
declare function getCategorySitemapEntries(client: BrainerceClient, opts: CategorySitemapOptions): Promise<SitemapEntry[]>;
|
|
10991
11046
|
|
|
10992
|
-
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DateAvailabilityConstraints, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type JsonLdOptions, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseWebhookEvent, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
|
11047
|
+
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DateAvailabilityConstraints, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type JsonLdOptions, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseWebhookEvent, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -4660,6 +4660,38 @@ interface PublicMetafieldDefinition {
|
|
|
4660
4660
|
defaultValue?: string | null;
|
|
4661
4661
|
position: number;
|
|
4662
4662
|
}
|
|
4663
|
+
/**
|
|
4664
|
+
* One facet value bucket with the number of DISTINCT active products carrying
|
|
4665
|
+
* it. For MULTI_SELECT definitions the stored arrays are split — a product
|
|
4666
|
+
* holding `["a","b"]` counts once for `a` and once for `b`. BOOLEAN buckets
|
|
4667
|
+
* normalize to `'true'` / `'false'`. Declared `enumValues` are always present
|
|
4668
|
+
* (including zero-count entries, so the UI can render disabled options);
|
|
4669
|
+
* stray stored values outside `enumValues` are reported as-is.
|
|
4670
|
+
*/
|
|
4671
|
+
interface MetafieldFilterValue {
|
|
4672
|
+
value: string;
|
|
4673
|
+
count: number;
|
|
4674
|
+
}
|
|
4675
|
+
/**
|
|
4676
|
+
* A filterable metafield definition plus per-value product counts — one entry
|
|
4677
|
+
* per facet the storefront should render. Returned by
|
|
4678
|
+
* {@link BrainerceClient.getMetafieldFilters}. `name` is localized per the
|
|
4679
|
+
* request locale. Pair the `key` with
|
|
4680
|
+
* `getProducts({ metafields: { [key]: [value] } })`.
|
|
4681
|
+
*/
|
|
4682
|
+
interface MetafieldFilter {
|
|
4683
|
+
id: string;
|
|
4684
|
+
key: string;
|
|
4685
|
+
name: string;
|
|
4686
|
+
type: MetafieldType;
|
|
4687
|
+
/** Declared allowed values for SELECT / MULTI_SELECT fields (with optional swatch metadata). */
|
|
4688
|
+
enumValues: CustomizationFieldOption[];
|
|
4689
|
+
values: MetafieldFilterValue[];
|
|
4690
|
+
}
|
|
4691
|
+
/** Response of `GET /metafield-filters` (vibe-coded and storefront modes). */
|
|
4692
|
+
interface MetafieldFiltersResponse {
|
|
4693
|
+
filters: MetafieldFilter[];
|
|
4694
|
+
}
|
|
4663
4695
|
/**
|
|
4664
4696
|
* A single selectable option for a SELECT or MULTI_SELECT customization field.
|
|
4665
4697
|
* Legacy string-only `enumValues` arrays are automatically promoted to this shape.
|
|
@@ -10144,6 +10176,29 @@ declare class BrainerceClient {
|
|
|
10144
10176
|
getPublicMetafieldDefinitions(): Promise<{
|
|
10145
10177
|
definitions: PublicMetafieldDefinition[];
|
|
10146
10178
|
}>;
|
|
10179
|
+
/**
|
|
10180
|
+
* Get facet value counts for filterable metafield definitions — one entry
|
|
10181
|
+
* per definition the merchant marked `filterable: true` (types SELECT /
|
|
10182
|
+
* MULTI_SELECT / BOOLEAN), each with DISTINCT-product counts per value.
|
|
10183
|
+
* Powers faceted navigation ("Color: red (12) / blue (3)") without one
|
|
10184
|
+
* `getProducts` round trip per candidate value.
|
|
10185
|
+
*
|
|
10186
|
+
* Available in vibe-coded and storefront modes. On the vibe-coded surface
|
|
10187
|
+
* only definitions published to your connection are returned, and counts
|
|
10188
|
+
* reflect only products published to it.
|
|
10189
|
+
*
|
|
10190
|
+
* @example
|
|
10191
|
+
* ```typescript
|
|
10192
|
+
* const { filters } = await client.getMetafieldFilters();
|
|
10193
|
+
* for (const f of filters) {
|
|
10194
|
+
* // f.key pairs with getProducts({ metafields: { [f.key]: [value] } })
|
|
10195
|
+
* console.log(f.name, f.values); // [{ value: 'red', count: 12 }, ...]
|
|
10196
|
+
* }
|
|
10197
|
+
* ```
|
|
10198
|
+
*/
|
|
10199
|
+
getMetafieldFilters(params?: {
|
|
10200
|
+
locale?: string;
|
|
10201
|
+
}): Promise<MetafieldFiltersResponse>;
|
|
10147
10202
|
/**
|
|
10148
10203
|
* Get all metafield definitions for the store
|
|
10149
10204
|
* Requires Admin mode (apiKey)
|
|
@@ -10651,7 +10706,7 @@ declare class BrainerceError extends Error {
|
|
|
10651
10706
|
constructor(message: string, statusCode: number, details?: unknown);
|
|
10652
10707
|
}
|
|
10653
10708
|
|
|
10654
|
-
declare const SDK_VERSION = "1.
|
|
10709
|
+
declare const SDK_VERSION = "1.51.0";
|
|
10655
10710
|
|
|
10656
10711
|
/**
|
|
10657
10712
|
* Verify a webhook signature from Brainerce
|
|
@@ -10989,4 +11044,4 @@ interface CategorySitemapOptions {
|
|
|
10989
11044
|
*/
|
|
10990
11045
|
declare function getCategorySitemapEntries(client: BrainerceClient, opts: CategorySitemapOptions): Promise<SitemapEntry[]>;
|
|
10991
11046
|
|
|
10992
|
-
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DateAvailabilityConstraints, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type JsonLdOptions, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseWebhookEvent, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
|
11047
|
+
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AttachModifierGroupInput, type Attribute, type AttributeOption, type AttributeSource, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DateAvailabilityConstraints, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type JsonLdOptions, type ListModifierGroupsParams, type LocalCart, type LocalCartItem, type LockedVariant, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type MyProductReview, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type RichTextContent, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SubmitProductReviewInput, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseWebhookEvent, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -199,7 +199,7 @@ function isDevGuardsEnabled() {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
// src/version.ts
|
|
202
|
-
var SDK_VERSION = "1.
|
|
202
|
+
var SDK_VERSION = "1.51.0";
|
|
203
203
|
|
|
204
204
|
// src/client.ts
|
|
205
205
|
var DEFAULT_BASE_URL = "https://api.brainerce.com";
|
|
@@ -8211,6 +8211,51 @@ var BrainerceClient = class {
|
|
|
8211
8211
|
}))
|
|
8212
8212
|
};
|
|
8213
8213
|
}
|
|
8214
|
+
/**
|
|
8215
|
+
* Get facet value counts for filterable metafield definitions — one entry
|
|
8216
|
+
* per definition the merchant marked `filterable: true` (types SELECT /
|
|
8217
|
+
* MULTI_SELECT / BOOLEAN), each with DISTINCT-product counts per value.
|
|
8218
|
+
* Powers faceted navigation ("Color: red (12) / blue (3)") without one
|
|
8219
|
+
* `getProducts` round trip per candidate value.
|
|
8220
|
+
*
|
|
8221
|
+
* Available in vibe-coded and storefront modes. On the vibe-coded surface
|
|
8222
|
+
* only definitions published to your connection are returned, and counts
|
|
8223
|
+
* reflect only products published to it.
|
|
8224
|
+
*
|
|
8225
|
+
* @example
|
|
8226
|
+
* ```typescript
|
|
8227
|
+
* const { filters } = await client.getMetafieldFilters();
|
|
8228
|
+
* for (const f of filters) {
|
|
8229
|
+
* // f.key pairs with getProducts({ metafields: { [f.key]: [value] } })
|
|
8230
|
+
* console.log(f.name, f.values); // [{ value: 'red', count: 12 }, ...]
|
|
8231
|
+
* }
|
|
8232
|
+
* ```
|
|
8233
|
+
*/
|
|
8234
|
+
async getMetafieldFilters(params) {
|
|
8235
|
+
const headerOverrides = params?.locale ? { "Accept-Language": params.locale } : void 0;
|
|
8236
|
+
if (this.isVibeCodedMode()) {
|
|
8237
|
+
return this.vibeCodedRequest(
|
|
8238
|
+
"GET",
|
|
8239
|
+
"/metafield-filters",
|
|
8240
|
+
void 0,
|
|
8241
|
+
void 0,
|
|
8242
|
+
headerOverrides
|
|
8243
|
+
);
|
|
8244
|
+
}
|
|
8245
|
+
if (this.storeId && !this.apiKey) {
|
|
8246
|
+
return this.storefrontRequest(
|
|
8247
|
+
"GET",
|
|
8248
|
+
"/metafield-filters",
|
|
8249
|
+
void 0,
|
|
8250
|
+
void 0,
|
|
8251
|
+
headerOverrides
|
|
8252
|
+
);
|
|
8253
|
+
}
|
|
8254
|
+
throw new BrainerceError(
|
|
8255
|
+
"getMetafieldFilters is only available in vibe-coded or storefront mode",
|
|
8256
|
+
400
|
|
8257
|
+
);
|
|
8258
|
+
}
|
|
8214
8259
|
/**
|
|
8215
8260
|
* Get all metafield definitions for the store
|
|
8216
8261
|
* Requires Admin mode (apiKey)
|
|
@@ -9114,6 +9159,12 @@ var ALLOWED_PAYMENT_HOSTS = [
|
|
|
9114
9159
|
// Takbull
|
|
9115
9160
|
"takbull.co.il",
|
|
9116
9161
|
"api.takbull.co.il",
|
|
9162
|
+
// MAX (מקס) — served by Hyp (formerly Yaad Sarig). `pay.hyp.co.il` is the
|
|
9163
|
+
// live gateway for MAX terminals, verified against a real MAX test terminal;
|
|
9164
|
+
// `icom.yaad.net` is the same backend under its legacy hostname and is still
|
|
9165
|
+
// reachable, so a terminal configured against it keeps working.
|
|
9166
|
+
"pay.hyp.co.il",
|
|
9167
|
+
"icom.yaad.net",
|
|
9117
9168
|
// Brainerce-hosted payment embeds (backend payment-embed proxy at
|
|
9118
9169
|
// `/api/payment/embed/...` that fronts provider apps' embed shells —
|
|
9119
9170
|
// e.g. cardcom-payments OpenFields wrapper). The match also covers
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,7 @@ function isDevGuardsEnabled() {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// src/version.ts
|
|
118
|
-
var SDK_VERSION = "1.
|
|
118
|
+
var SDK_VERSION = "1.51.0";
|
|
119
119
|
|
|
120
120
|
// src/client.ts
|
|
121
121
|
var DEFAULT_BASE_URL = "https://api.brainerce.com";
|
|
@@ -8127,6 +8127,51 @@ var BrainerceClient = class {
|
|
|
8127
8127
|
}))
|
|
8128
8128
|
};
|
|
8129
8129
|
}
|
|
8130
|
+
/**
|
|
8131
|
+
* Get facet value counts for filterable metafield definitions — one entry
|
|
8132
|
+
* per definition the merchant marked `filterable: true` (types SELECT /
|
|
8133
|
+
* MULTI_SELECT / BOOLEAN), each with DISTINCT-product counts per value.
|
|
8134
|
+
* Powers faceted navigation ("Color: red (12) / blue (3)") without one
|
|
8135
|
+
* `getProducts` round trip per candidate value.
|
|
8136
|
+
*
|
|
8137
|
+
* Available in vibe-coded and storefront modes. On the vibe-coded surface
|
|
8138
|
+
* only definitions published to your connection are returned, and counts
|
|
8139
|
+
* reflect only products published to it.
|
|
8140
|
+
*
|
|
8141
|
+
* @example
|
|
8142
|
+
* ```typescript
|
|
8143
|
+
* const { filters } = await client.getMetafieldFilters();
|
|
8144
|
+
* for (const f of filters) {
|
|
8145
|
+
* // f.key pairs with getProducts({ metafields: { [f.key]: [value] } })
|
|
8146
|
+
* console.log(f.name, f.values); // [{ value: 'red', count: 12 }, ...]
|
|
8147
|
+
* }
|
|
8148
|
+
* ```
|
|
8149
|
+
*/
|
|
8150
|
+
async getMetafieldFilters(params) {
|
|
8151
|
+
const headerOverrides = params?.locale ? { "Accept-Language": params.locale } : void 0;
|
|
8152
|
+
if (this.isVibeCodedMode()) {
|
|
8153
|
+
return this.vibeCodedRequest(
|
|
8154
|
+
"GET",
|
|
8155
|
+
"/metafield-filters",
|
|
8156
|
+
void 0,
|
|
8157
|
+
void 0,
|
|
8158
|
+
headerOverrides
|
|
8159
|
+
);
|
|
8160
|
+
}
|
|
8161
|
+
if (this.storeId && !this.apiKey) {
|
|
8162
|
+
return this.storefrontRequest(
|
|
8163
|
+
"GET",
|
|
8164
|
+
"/metafield-filters",
|
|
8165
|
+
void 0,
|
|
8166
|
+
void 0,
|
|
8167
|
+
headerOverrides
|
|
8168
|
+
);
|
|
8169
|
+
}
|
|
8170
|
+
throw new BrainerceError(
|
|
8171
|
+
"getMetafieldFilters is only available in vibe-coded or storefront mode",
|
|
8172
|
+
400
|
|
8173
|
+
);
|
|
8174
|
+
}
|
|
8130
8175
|
/**
|
|
8131
8176
|
* Get all metafield definitions for the store
|
|
8132
8177
|
* Requires Admin mode (apiKey)
|
|
@@ -9030,6 +9075,12 @@ var ALLOWED_PAYMENT_HOSTS = [
|
|
|
9030
9075
|
// Takbull
|
|
9031
9076
|
"takbull.co.il",
|
|
9032
9077
|
"api.takbull.co.il",
|
|
9078
|
+
// MAX (מקס) — served by Hyp (formerly Yaad Sarig). `pay.hyp.co.il` is the
|
|
9079
|
+
// live gateway for MAX terminals, verified against a real MAX test terminal;
|
|
9080
|
+
// `icom.yaad.net` is the same backend under its legacy hostname and is still
|
|
9081
|
+
// reachable, so a terminal configured against it keeps working.
|
|
9082
|
+
"pay.hyp.co.il",
|
|
9083
|
+
"icom.yaad.net",
|
|
9033
9084
|
// Brainerce-hosted payment embeds (backend payment-embed proxy at
|
|
9034
9085
|
// `/api/payment/embed/...` that fronts provider apps' embed shells —
|
|
9035
9086
|
// e.g. cardcom-payments OpenFields wrapper). The match also covers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.51.0",
|
|
4
4
|
"description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|