@snowcone-app/sdk 0.12.1 → 0.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#625](https://github.com/snowcone-app/snowcone-monorepo/pull/625) [`1f9e32d`](https://github.com/snowcone-app/snowcone-monorepo/commit/1f9e32d65a53cd9be2fea4f858cba485837f19e7) Thanks [@kevinsproles](https://github.com/kevinsproles)! - New `searchDesigns(query, options)` + `client.catalog.designs.search()` for the
8
+ public pre-made designs catalog (`snowcone-designs` Meilisearch index), with
9
+ `meilisearch.designsIndex` config / `NEXT_PUBLIC_MEILISEARCH_DESIGNS_INDEX` env
10
+ override and a loose `CatalogDesign` type carrying mockup-URL components
11
+ (`productId`, `asset`, `assets`, `variant`, reserved `slots`).
12
+
3
13
  ## 0.12.1
4
14
 
5
15
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -136,6 +136,7 @@ __export(index_exports, {
136
136
  resolveMockupId: () => resolveMockupId,
137
137
  resolveVariantId: () => resolveVariantId,
138
138
  retryOperation: () => retryOperation,
139
+ searchDesigns: () => searchDesigns,
139
140
  simulateCartOperation: () => simulateCartOperation,
140
141
  toCombinations: () => toCombinations,
141
142
  toOptionAttributes: () => toOptionAttributes,
@@ -6101,13 +6102,43 @@ async function getProduct(idOrSlug, config) {
6101
6102
  const raw = await res.json();
6102
6103
  return validateProductLoose(raw);
6103
6104
  }
6105
+ async function searchDesigns(query = "", options) {
6106
+ const f = getFetcher(options);
6107
+ const meilisearchHost = options?.meilisearch?.host || typeof process !== "undefined" && process.env?.NEXT_PUBLIC_MEILISEARCH_HOST || "https://search.snowcone.app";
6108
+ const meilisearchApiKey = options?.meilisearch?.apiKey || typeof process !== "undefined" && process.env?.NEXT_PUBLIC_MEILISEARCH_API_KEY || "eee819b849798ad9091228c486ec05d0931e5292";
6109
+ const designsIndex = options?.meilisearch?.designsIndex || typeof process !== "undefined" && process.env?.NEXT_PUBLIC_MEILISEARCH_DESIGNS_INDEX || "snowcone-designs";
6110
+ const headers = {
6111
+ "Content-Type": "application/json"
6112
+ };
6113
+ if (meilisearchApiKey) {
6114
+ headers["Authorization"] = `Bearer ${meilisearchApiKey}`;
6115
+ }
6116
+ const url = `${meilisearchHost}/indexes/${designsIndex}/search`;
6117
+ const res = await f(url, {
6118
+ method: "POST",
6119
+ headers,
6120
+ body: JSON.stringify({
6121
+ q: query,
6122
+ limit: options?.limit || 50,
6123
+ ...options?.offset ? { offset: options.offset } : {},
6124
+ ...options?.filter ? { filter: options.filter } : {}
6125
+ })
6126
+ });
6127
+ if (!res.ok) throw new Error(`searchDesigns failed: ${res.status}`);
6128
+ const data = await res.json();
6129
+ const items = data.hits || [];
6130
+ return { items, total: data.estimatedTotalHits || items.length };
6131
+ }
6104
6132
  function createClient(config) {
6105
6133
  const fetcher = getFetcher(config);
6106
6134
  const mockupService = new MockupServiceImpl(config.mockup || {}, fetcher);
6107
6135
  return {
6108
6136
  catalog: {
6109
6137
  listProducts: (overrides) => listProducts({ ...config, ...overrides }),
6110
- getProduct: (idOrSlug, overrides) => getProduct(idOrSlug, { ...config, ...overrides })
6138
+ getProduct: (idOrSlug, overrides) => getProduct(idOrSlug, { ...config, ...overrides }),
6139
+ designs: {
6140
+ search: (query, options) => searchDesigns(query, { ...config, ...options })
6141
+ }
6111
6142
  },
6112
6143
  mockup: mockupService
6113
6144
  };
@@ -6230,6 +6261,7 @@ function createClient(config) {
6230
6261
  resolveMockupId,
6231
6262
  resolveVariantId,
6232
6263
  retryOperation,
6264
+ searchDesigns,
6233
6265
  simulateCartOperation,
6234
6266
  toCombinations,
6235
6267
  toOptionAttributes,
package/dist/index.d.cts CHANGED
@@ -3097,20 +3097,75 @@ interface SdkConfig {
3097
3097
  host?: string;
3098
3098
  apiKey?: string;
3099
3099
  index?: string;
3100
+ /** Public designs-catalog index (pre-made, remixable designs). */
3101
+ designsIndex?: string;
3100
3102
  };
3101
3103
  }
3104
+ /**
3105
+ * A pre-made design from the public designs catalog (loosely typed). Docs
3106
+ * carry mockup-URL COMPONENTS (productId + per-placement asset URLs +
3107
+ * variant), never assembled URLs — build render URLs via @snowcone-app/mockup-url
3108
+ * (or pass `design`/`asset` straight into the canvas/embed primitives).
3109
+ */
3110
+ interface CatalogDesign {
3111
+ /** = pairingId (the catalog document id). */
3112
+ id: string;
3113
+ pairingId?: string;
3114
+ slug?: string | null;
3115
+ title?: string;
3116
+ description?: string | null;
3117
+ tags?: string[];
3118
+ occasion?: string | null;
3119
+ style?: string | null;
3120
+ /** Product short code — the mockup URL path segment. */
3121
+ productId?: string;
3122
+ variant?: string | null;
3123
+ /** Bare-asset render component (flattened full-canvas export). */
3124
+ asset?: string | null;
3125
+ /** Per-placement render components: placement KEY → image URL. */
3126
+ assets?: Record<string, string> | null;
3127
+ previewThumbnail?: string | null;
3128
+ minPriceCents?: number | null;
3129
+ license?: {
3130
+ remixable?: boolean;
3131
+ };
3132
+ firstParty?: boolean;
3133
+ /** RESERVED — always null today; future structured slot metadata. */
3134
+ slots?: unknown;
3135
+ [key: string]: unknown;
3136
+ }
3137
+ interface DesignsSearchResponse {
3138
+ items: CatalogDesign[];
3139
+ total: number;
3140
+ }
3141
+ interface SearchDesignsOptions extends Partial<SdkConfig> {
3142
+ limit?: number;
3143
+ offset?: number;
3144
+ /** Meilisearch filter, e.g. "occasion = 'christmas' AND style = 'watercolor'". */
3145
+ filter?: string;
3146
+ }
3102
3147
  interface SnowconeClient {
3103
3148
  catalog: {
3104
3149
  listProducts(config?: Partial<SdkConfig>): Promise<CatalogListResponse>;
3105
3150
  getProduct(idOrSlug: string, config?: Partial<SdkConfig>): Promise<CatalogProduct>;
3151
+ designs: {
3152
+ search(query?: string, options?: SearchDesignsOptions): Promise<DesignsSearchResponse>;
3153
+ };
3106
3154
  };
3107
3155
  mockup: MockupService;
3108
3156
  }
3109
3157
  declare function listProducts(config?: Partial<SdkConfig>): Promise<CatalogListResponse>;
3110
3158
  declare function getProduct(idOrSlug: string, config?: Partial<SdkConfig>): Promise<CatalogProduct>;
3159
+ /**
3160
+ * Search the public pre-made designs catalog (first-party-curated, remixable
3161
+ * designs) so an integration never starts from a blank canvas. Returns
3162
+ * mockup-URL components per design — feed `assets` (or `asset`) into
3163
+ * @snowcone-app/mockup-url's builder or the canvas/embed primitives.
3164
+ */
3165
+ declare function searchDesigns(query?: string, options?: SearchDesignsOptions): Promise<DesignsSearchResponse>;
3111
3166
  /**
3112
3167
  * Create a unified Snowcone client with catalog and mockup services
3113
3168
  */
3114
3169
  declare function createClient(config: SdkConfig): SnowconeClient;
3115
3170
 
3116
- export { AbstractTemplateRenderer, type AddToCartOptions, Animations, type ArtSelectorContext, type ArtSelectorDescriptor, type ArtSelectorOptions, type ArtworkData, type AspectRatio, Attributes, type BaseDescriptor, type BlendConfig, type BuildMockupUrlConfig, type CartDetail, type CatalogListResponse, type CatalogProduct, ClassNames, type ColorDesignElement, ColorPickerUtils, Combination, CommonProps, ComponentContext, type ComponentDefinition, ComponentDescriptor, ComponentEventManager, ComponentFactory, ComponentLifecycle, ComponentLifecycleHooks, type ComponentMetadata, ComponentProps, ComponentRegistry, ComponentState, type ComponentTemplate, ComponentTemplates, type ContainerDescriptor, ContextBridge, type ContextComparator, type ContextConsumer, ContextInjector, type ContextProviderConfig, type ContextSubscriber, ContextSynchronizer, type CreateDesignStateInput, type CreatedDesignState, DEFAULT_ARTWORK_URL, DEFAULT_ASPECT_RATIO, DEFAULT_BUY_BASE, DEFAULT_COLOR, DEFAULT_GRANT_BASE, DEFAULT_MOCKUP_BASE, DEFAULT_PLACEMENT_DIMENSIONS, type Descriptor, type Design, type DesignElement, type DesignGenerationContext, type DesignLike, type Effects, Elements, type ErrorContext, type ErrorHandler, ErrorManager, type EventDefinition, EventDelegator, EventEmitter, EventHandler, type EventListener, type EventPayload, type Fill, Focus, FrameworkAdapter, FrameworkUtilities, type GetMockupUrlOptions, type ImageAlignment, type ImageDesignElement, type LifecycleHook, LifecycleManager, type LifecyclePhase, type LifecycleTransition, LitAdapter, type MaskOverride, type MockupGenerationOptions, MockupResult, type MockupService, type MockupServiceConfig, OptionAttribute, type OptionChoice, type OptionChoiceRenderData, type OptionRenderData, OptionSelection, type Placement, type PlacementDesign, PlacementSettings, type ProductArtAlignmentContext, type ProductArtAlignmentDescriptor, type ProductArtAlignmentOptions, type ProductContext, type ProductContextEvents, ProductContextManager, type ProductData, type ProductFetcher, type ProductImageDescriptor, type ProductImageOptions, ProductLoader, type ProductMockupData, type ProductOptionChoice, type ProductOptionData, type ProductOptionsDescriptor, type ProductOptionsOptions, type ProductPlacement, type ProductPriceDescriptor, type ProductPriceOptions, ProductProps, type ProductSpec, type ProductTitleDescriptor, type ProductTitleOptions, type ProductVariant, type PropDefinition, type PropSchema, type PropType, PropertyManager, REALTIME_WS_URL, type RateLimitState, type RealtimeGrant, RealtimeMockupService, type RegularArtwork, type RenderProduct, type RenderProductAttribute, type RenderProductAttributeChoice, type RenderProductCombination, type RenderProductMockup, type RenderProductOptions, type RenderProductRequiredPlacement, RenderSession, type RenderSessionOptions, type RenderState, type SdkConfig, type SeamlessPattern, type SignedUrlResponse, type SnowconeClient, StandardComponents, StandardEvents, StateManager, type StateManagerOptions, type StateMiddleware, type StateSelector, type StateSubscriber, type StateUpdater, Styles, SvelteAdapter, SwatchUtils, type TagName, TemplateBuilder, type TemplateNode, type TemplateNodeType, type TemplateRenderer, type TextDescriptor, type TileCount, UniversalContextProvider, type UserSelection, type ValidationError, type ValidationResult, VueAdapter, assertVariantSelected, autoRegister, bffSigner, buildMockupUrl, componentRegistry, createAddToCartEvent, createAddToCartHandler, createCartDetail, createClient, createContextProvider, createDesignForPlacements, createDesignState, createErrorHandler, createEventManager, createLifecycle, createLitComponent, createProductContext, createProductLoader, createPropertyManager, createStateHook, createStateStore, createSvelteComponent, createUniversalProvider, createVueComponent, describeArtSelector, describeProductArtAlignment, describeProductImage, describeProductOptions, describeProductPrice, describeProductTitle, extractProductId, fetchRealtimeGrant, filterImagePlacements, findClosestSnapPoint, findVariantForSelection, formatPrice, formatValidationErrors, getBuyUrl, getDefaultVariantId, getEffectiveAlignment, getIncompleteSelectionMessage, getMissingSelections, getMockupUrl, getOptionRenderType, getProduct, getSelectionDisplayText, getSnapPoints, getVariant, handleOptionChange, isSelectionComplete, isValidAlignment, isValidTileCount, listProducts, mintRealtimeGrant, mockupUrl, normalizeChoice, prepareOptionRenderData, registerStandardComponents, resolveMockupId, resolveVariantId, retryOperation, simulateCartOperation, toCombinations, toOptionAttributes, useFrameworkAdapter as useVueAdapter, validateAlignment, validateDesignElement, validateEffects, validateImageUrl, validateMockupOptions, validateProductSelection, validateProductSpec, validateRequiredOptions, validateTileCount, warnVariantNotSelected, withContext, withErrorHandling, withSyncErrorHandling };
3171
+ export { AbstractTemplateRenderer, type AddToCartOptions, Animations, type ArtSelectorContext, type ArtSelectorDescriptor, type ArtSelectorOptions, type ArtworkData, type AspectRatio, Attributes, type BaseDescriptor, type BlendConfig, type BuildMockupUrlConfig, type CartDetail, type CatalogDesign, type CatalogListResponse, type CatalogProduct, ClassNames, type ColorDesignElement, ColorPickerUtils, Combination, CommonProps, ComponentContext, type ComponentDefinition, ComponentDescriptor, ComponentEventManager, ComponentFactory, ComponentLifecycle, ComponentLifecycleHooks, type ComponentMetadata, ComponentProps, ComponentRegistry, ComponentState, type ComponentTemplate, ComponentTemplates, type ContainerDescriptor, ContextBridge, type ContextComparator, type ContextConsumer, ContextInjector, type ContextProviderConfig, type ContextSubscriber, ContextSynchronizer, type CreateDesignStateInput, type CreatedDesignState, DEFAULT_ARTWORK_URL, DEFAULT_ASPECT_RATIO, DEFAULT_BUY_BASE, DEFAULT_COLOR, DEFAULT_GRANT_BASE, DEFAULT_MOCKUP_BASE, DEFAULT_PLACEMENT_DIMENSIONS, type Descriptor, type Design, type DesignElement, type DesignGenerationContext, type DesignLike, type DesignsSearchResponse, type Effects, Elements, type ErrorContext, type ErrorHandler, ErrorManager, type EventDefinition, EventDelegator, EventEmitter, EventHandler, type EventListener, type EventPayload, type Fill, Focus, FrameworkAdapter, FrameworkUtilities, type GetMockupUrlOptions, type ImageAlignment, type ImageDesignElement, type LifecycleHook, LifecycleManager, type LifecyclePhase, type LifecycleTransition, LitAdapter, type MaskOverride, type MockupGenerationOptions, MockupResult, type MockupService, type MockupServiceConfig, OptionAttribute, type OptionChoice, type OptionChoiceRenderData, type OptionRenderData, OptionSelection, type Placement, type PlacementDesign, PlacementSettings, type ProductArtAlignmentContext, type ProductArtAlignmentDescriptor, type ProductArtAlignmentOptions, type ProductContext, type ProductContextEvents, ProductContextManager, type ProductData, type ProductFetcher, type ProductImageDescriptor, type ProductImageOptions, ProductLoader, type ProductMockupData, type ProductOptionChoice, type ProductOptionData, type ProductOptionsDescriptor, type ProductOptionsOptions, type ProductPlacement, type ProductPriceDescriptor, type ProductPriceOptions, ProductProps, type ProductSpec, type ProductTitleDescriptor, type ProductTitleOptions, type ProductVariant, type PropDefinition, type PropSchema, type PropType, PropertyManager, REALTIME_WS_URL, type RateLimitState, type RealtimeGrant, RealtimeMockupService, type RegularArtwork, type RenderProduct, type RenderProductAttribute, type RenderProductAttributeChoice, type RenderProductCombination, type RenderProductMockup, type RenderProductOptions, type RenderProductRequiredPlacement, RenderSession, type RenderSessionOptions, type RenderState, type SdkConfig, type SeamlessPattern, type SearchDesignsOptions, type SignedUrlResponse, type SnowconeClient, StandardComponents, StandardEvents, StateManager, type StateManagerOptions, type StateMiddleware, type StateSelector, type StateSubscriber, type StateUpdater, Styles, SvelteAdapter, SwatchUtils, type TagName, TemplateBuilder, type TemplateNode, type TemplateNodeType, type TemplateRenderer, type TextDescriptor, type TileCount, UniversalContextProvider, type UserSelection, type ValidationError, type ValidationResult, VueAdapter, assertVariantSelected, autoRegister, bffSigner, buildMockupUrl, componentRegistry, createAddToCartEvent, createAddToCartHandler, createCartDetail, createClient, createContextProvider, createDesignForPlacements, createDesignState, createErrorHandler, createEventManager, createLifecycle, createLitComponent, createProductContext, createProductLoader, createPropertyManager, createStateHook, createStateStore, createSvelteComponent, createUniversalProvider, createVueComponent, describeArtSelector, describeProductArtAlignment, describeProductImage, describeProductOptions, describeProductPrice, describeProductTitle, extractProductId, fetchRealtimeGrant, filterImagePlacements, findClosestSnapPoint, findVariantForSelection, formatPrice, formatValidationErrors, getBuyUrl, getDefaultVariantId, getEffectiveAlignment, getIncompleteSelectionMessage, getMissingSelections, getMockupUrl, getOptionRenderType, getProduct, getSelectionDisplayText, getSnapPoints, getVariant, handleOptionChange, isSelectionComplete, isValidAlignment, isValidTileCount, listProducts, mintRealtimeGrant, mockupUrl, normalizeChoice, prepareOptionRenderData, registerStandardComponents, resolveMockupId, resolveVariantId, retryOperation, searchDesigns, simulateCartOperation, toCombinations, toOptionAttributes, useFrameworkAdapter as useVueAdapter, validateAlignment, validateDesignElement, validateEffects, validateImageUrl, validateMockupOptions, validateProductSelection, validateProductSpec, validateRequiredOptions, validateTileCount, warnVariantNotSelected, withContext, withErrorHandling, withSyncErrorHandling };
package/dist/index.d.ts CHANGED
@@ -3097,20 +3097,75 @@ interface SdkConfig {
3097
3097
  host?: string;
3098
3098
  apiKey?: string;
3099
3099
  index?: string;
3100
+ /** Public designs-catalog index (pre-made, remixable designs). */
3101
+ designsIndex?: string;
3100
3102
  };
3101
3103
  }
3104
+ /**
3105
+ * A pre-made design from the public designs catalog (loosely typed). Docs
3106
+ * carry mockup-URL COMPONENTS (productId + per-placement asset URLs +
3107
+ * variant), never assembled URLs — build render URLs via @snowcone-app/mockup-url
3108
+ * (or pass `design`/`asset` straight into the canvas/embed primitives).
3109
+ */
3110
+ interface CatalogDesign {
3111
+ /** = pairingId (the catalog document id). */
3112
+ id: string;
3113
+ pairingId?: string;
3114
+ slug?: string | null;
3115
+ title?: string;
3116
+ description?: string | null;
3117
+ tags?: string[];
3118
+ occasion?: string | null;
3119
+ style?: string | null;
3120
+ /** Product short code — the mockup URL path segment. */
3121
+ productId?: string;
3122
+ variant?: string | null;
3123
+ /** Bare-asset render component (flattened full-canvas export). */
3124
+ asset?: string | null;
3125
+ /** Per-placement render components: placement KEY → image URL. */
3126
+ assets?: Record<string, string> | null;
3127
+ previewThumbnail?: string | null;
3128
+ minPriceCents?: number | null;
3129
+ license?: {
3130
+ remixable?: boolean;
3131
+ };
3132
+ firstParty?: boolean;
3133
+ /** RESERVED — always null today; future structured slot metadata. */
3134
+ slots?: unknown;
3135
+ [key: string]: unknown;
3136
+ }
3137
+ interface DesignsSearchResponse {
3138
+ items: CatalogDesign[];
3139
+ total: number;
3140
+ }
3141
+ interface SearchDesignsOptions extends Partial<SdkConfig> {
3142
+ limit?: number;
3143
+ offset?: number;
3144
+ /** Meilisearch filter, e.g. "occasion = 'christmas' AND style = 'watercolor'". */
3145
+ filter?: string;
3146
+ }
3102
3147
  interface SnowconeClient {
3103
3148
  catalog: {
3104
3149
  listProducts(config?: Partial<SdkConfig>): Promise<CatalogListResponse>;
3105
3150
  getProduct(idOrSlug: string, config?: Partial<SdkConfig>): Promise<CatalogProduct>;
3151
+ designs: {
3152
+ search(query?: string, options?: SearchDesignsOptions): Promise<DesignsSearchResponse>;
3153
+ };
3106
3154
  };
3107
3155
  mockup: MockupService;
3108
3156
  }
3109
3157
  declare function listProducts(config?: Partial<SdkConfig>): Promise<CatalogListResponse>;
3110
3158
  declare function getProduct(idOrSlug: string, config?: Partial<SdkConfig>): Promise<CatalogProduct>;
3159
+ /**
3160
+ * Search the public pre-made designs catalog (first-party-curated, remixable
3161
+ * designs) so an integration never starts from a blank canvas. Returns
3162
+ * mockup-URL components per design — feed `assets` (or `asset`) into
3163
+ * @snowcone-app/mockup-url's builder or the canvas/embed primitives.
3164
+ */
3165
+ declare function searchDesigns(query?: string, options?: SearchDesignsOptions): Promise<DesignsSearchResponse>;
3111
3166
  /**
3112
3167
  * Create a unified Snowcone client with catalog and mockup services
3113
3168
  */
3114
3169
  declare function createClient(config: SdkConfig): SnowconeClient;
3115
3170
 
3116
- export { AbstractTemplateRenderer, type AddToCartOptions, Animations, type ArtSelectorContext, type ArtSelectorDescriptor, type ArtSelectorOptions, type ArtworkData, type AspectRatio, Attributes, type BaseDescriptor, type BlendConfig, type BuildMockupUrlConfig, type CartDetail, type CatalogListResponse, type CatalogProduct, ClassNames, type ColorDesignElement, ColorPickerUtils, Combination, CommonProps, ComponentContext, type ComponentDefinition, ComponentDescriptor, ComponentEventManager, ComponentFactory, ComponentLifecycle, ComponentLifecycleHooks, type ComponentMetadata, ComponentProps, ComponentRegistry, ComponentState, type ComponentTemplate, ComponentTemplates, type ContainerDescriptor, ContextBridge, type ContextComparator, type ContextConsumer, ContextInjector, type ContextProviderConfig, type ContextSubscriber, ContextSynchronizer, type CreateDesignStateInput, type CreatedDesignState, DEFAULT_ARTWORK_URL, DEFAULT_ASPECT_RATIO, DEFAULT_BUY_BASE, DEFAULT_COLOR, DEFAULT_GRANT_BASE, DEFAULT_MOCKUP_BASE, DEFAULT_PLACEMENT_DIMENSIONS, type Descriptor, type Design, type DesignElement, type DesignGenerationContext, type DesignLike, type Effects, Elements, type ErrorContext, type ErrorHandler, ErrorManager, type EventDefinition, EventDelegator, EventEmitter, EventHandler, type EventListener, type EventPayload, type Fill, Focus, FrameworkAdapter, FrameworkUtilities, type GetMockupUrlOptions, type ImageAlignment, type ImageDesignElement, type LifecycleHook, LifecycleManager, type LifecyclePhase, type LifecycleTransition, LitAdapter, type MaskOverride, type MockupGenerationOptions, MockupResult, type MockupService, type MockupServiceConfig, OptionAttribute, type OptionChoice, type OptionChoiceRenderData, type OptionRenderData, OptionSelection, type Placement, type PlacementDesign, PlacementSettings, type ProductArtAlignmentContext, type ProductArtAlignmentDescriptor, type ProductArtAlignmentOptions, type ProductContext, type ProductContextEvents, ProductContextManager, type ProductData, type ProductFetcher, type ProductImageDescriptor, type ProductImageOptions, ProductLoader, type ProductMockupData, type ProductOptionChoice, type ProductOptionData, type ProductOptionsDescriptor, type ProductOptionsOptions, type ProductPlacement, type ProductPriceDescriptor, type ProductPriceOptions, ProductProps, type ProductSpec, type ProductTitleDescriptor, type ProductTitleOptions, type ProductVariant, type PropDefinition, type PropSchema, type PropType, PropertyManager, REALTIME_WS_URL, type RateLimitState, type RealtimeGrant, RealtimeMockupService, type RegularArtwork, type RenderProduct, type RenderProductAttribute, type RenderProductAttributeChoice, type RenderProductCombination, type RenderProductMockup, type RenderProductOptions, type RenderProductRequiredPlacement, RenderSession, type RenderSessionOptions, type RenderState, type SdkConfig, type SeamlessPattern, type SignedUrlResponse, type SnowconeClient, StandardComponents, StandardEvents, StateManager, type StateManagerOptions, type StateMiddleware, type StateSelector, type StateSubscriber, type StateUpdater, Styles, SvelteAdapter, SwatchUtils, type TagName, TemplateBuilder, type TemplateNode, type TemplateNodeType, type TemplateRenderer, type TextDescriptor, type TileCount, UniversalContextProvider, type UserSelection, type ValidationError, type ValidationResult, VueAdapter, assertVariantSelected, autoRegister, bffSigner, buildMockupUrl, componentRegistry, createAddToCartEvent, createAddToCartHandler, createCartDetail, createClient, createContextProvider, createDesignForPlacements, createDesignState, createErrorHandler, createEventManager, createLifecycle, createLitComponent, createProductContext, createProductLoader, createPropertyManager, createStateHook, createStateStore, createSvelteComponent, createUniversalProvider, createVueComponent, describeArtSelector, describeProductArtAlignment, describeProductImage, describeProductOptions, describeProductPrice, describeProductTitle, extractProductId, fetchRealtimeGrant, filterImagePlacements, findClosestSnapPoint, findVariantForSelection, formatPrice, formatValidationErrors, getBuyUrl, getDefaultVariantId, getEffectiveAlignment, getIncompleteSelectionMessage, getMissingSelections, getMockupUrl, getOptionRenderType, getProduct, getSelectionDisplayText, getSnapPoints, getVariant, handleOptionChange, isSelectionComplete, isValidAlignment, isValidTileCount, listProducts, mintRealtimeGrant, mockupUrl, normalizeChoice, prepareOptionRenderData, registerStandardComponents, resolveMockupId, resolveVariantId, retryOperation, simulateCartOperation, toCombinations, toOptionAttributes, useFrameworkAdapter as useVueAdapter, validateAlignment, validateDesignElement, validateEffects, validateImageUrl, validateMockupOptions, validateProductSelection, validateProductSpec, validateRequiredOptions, validateTileCount, warnVariantNotSelected, withContext, withErrorHandling, withSyncErrorHandling };
3171
+ export { AbstractTemplateRenderer, type AddToCartOptions, Animations, type ArtSelectorContext, type ArtSelectorDescriptor, type ArtSelectorOptions, type ArtworkData, type AspectRatio, Attributes, type BaseDescriptor, type BlendConfig, type BuildMockupUrlConfig, type CartDetail, type CatalogDesign, type CatalogListResponse, type CatalogProduct, ClassNames, type ColorDesignElement, ColorPickerUtils, Combination, CommonProps, ComponentContext, type ComponentDefinition, ComponentDescriptor, ComponentEventManager, ComponentFactory, ComponentLifecycle, ComponentLifecycleHooks, type ComponentMetadata, ComponentProps, ComponentRegistry, ComponentState, type ComponentTemplate, ComponentTemplates, type ContainerDescriptor, ContextBridge, type ContextComparator, type ContextConsumer, ContextInjector, type ContextProviderConfig, type ContextSubscriber, ContextSynchronizer, type CreateDesignStateInput, type CreatedDesignState, DEFAULT_ARTWORK_URL, DEFAULT_ASPECT_RATIO, DEFAULT_BUY_BASE, DEFAULT_COLOR, DEFAULT_GRANT_BASE, DEFAULT_MOCKUP_BASE, DEFAULT_PLACEMENT_DIMENSIONS, type Descriptor, type Design, type DesignElement, type DesignGenerationContext, type DesignLike, type DesignsSearchResponse, type Effects, Elements, type ErrorContext, type ErrorHandler, ErrorManager, type EventDefinition, EventDelegator, EventEmitter, EventHandler, type EventListener, type EventPayload, type Fill, Focus, FrameworkAdapter, FrameworkUtilities, type GetMockupUrlOptions, type ImageAlignment, type ImageDesignElement, type LifecycleHook, LifecycleManager, type LifecyclePhase, type LifecycleTransition, LitAdapter, type MaskOverride, type MockupGenerationOptions, MockupResult, type MockupService, type MockupServiceConfig, OptionAttribute, type OptionChoice, type OptionChoiceRenderData, type OptionRenderData, OptionSelection, type Placement, type PlacementDesign, PlacementSettings, type ProductArtAlignmentContext, type ProductArtAlignmentDescriptor, type ProductArtAlignmentOptions, type ProductContext, type ProductContextEvents, ProductContextManager, type ProductData, type ProductFetcher, type ProductImageDescriptor, type ProductImageOptions, ProductLoader, type ProductMockupData, type ProductOptionChoice, type ProductOptionData, type ProductOptionsDescriptor, type ProductOptionsOptions, type ProductPlacement, type ProductPriceDescriptor, type ProductPriceOptions, ProductProps, type ProductSpec, type ProductTitleDescriptor, type ProductTitleOptions, type ProductVariant, type PropDefinition, type PropSchema, type PropType, PropertyManager, REALTIME_WS_URL, type RateLimitState, type RealtimeGrant, RealtimeMockupService, type RegularArtwork, type RenderProduct, type RenderProductAttribute, type RenderProductAttributeChoice, type RenderProductCombination, type RenderProductMockup, type RenderProductOptions, type RenderProductRequiredPlacement, RenderSession, type RenderSessionOptions, type RenderState, type SdkConfig, type SeamlessPattern, type SearchDesignsOptions, type SignedUrlResponse, type SnowconeClient, StandardComponents, StandardEvents, StateManager, type StateManagerOptions, type StateMiddleware, type StateSelector, type StateSubscriber, type StateUpdater, Styles, SvelteAdapter, SwatchUtils, type TagName, TemplateBuilder, type TemplateNode, type TemplateNodeType, type TemplateRenderer, type TextDescriptor, type TileCount, UniversalContextProvider, type UserSelection, type ValidationError, type ValidationResult, VueAdapter, assertVariantSelected, autoRegister, bffSigner, buildMockupUrl, componentRegistry, createAddToCartEvent, createAddToCartHandler, createCartDetail, createClient, createContextProvider, createDesignForPlacements, createDesignState, createErrorHandler, createEventManager, createLifecycle, createLitComponent, createProductContext, createProductLoader, createPropertyManager, createStateHook, createStateStore, createSvelteComponent, createUniversalProvider, createVueComponent, describeArtSelector, describeProductArtAlignment, describeProductImage, describeProductOptions, describeProductPrice, describeProductTitle, extractProductId, fetchRealtimeGrant, filterImagePlacements, findClosestSnapPoint, findVariantForSelection, formatPrice, formatValidationErrors, getBuyUrl, getDefaultVariantId, getEffectiveAlignment, getIncompleteSelectionMessage, getMissingSelections, getMockupUrl, getOptionRenderType, getProduct, getSelectionDisplayText, getSnapPoints, getVariant, handleOptionChange, isSelectionComplete, isValidAlignment, isValidTileCount, listProducts, mintRealtimeGrant, mockupUrl, normalizeChoice, prepareOptionRenderData, registerStandardComponents, resolveMockupId, resolveVariantId, retryOperation, searchDesigns, simulateCartOperation, toCombinations, toOptionAttributes, useFrameworkAdapter as useVueAdapter, validateAlignment, validateDesignElement, validateEffects, validateImageUrl, validateMockupOptions, validateProductSelection, validateProductSpec, validateRequiredOptions, validateTileCount, warnVariantNotSelected, withContext, withErrorHandling, withSyncErrorHandling };
package/dist/index.js CHANGED
@@ -4977,13 +4977,43 @@ async function getProduct(idOrSlug, config) {
4977
4977
  const raw = await res.json();
4978
4978
  return validateProductLoose(raw);
4979
4979
  }
4980
+ async function searchDesigns(query = "", options) {
4981
+ const f = getFetcher(options);
4982
+ const meilisearchHost = options?.meilisearch?.host || typeof process !== "undefined" && process.env?.NEXT_PUBLIC_MEILISEARCH_HOST || "https://search.snowcone.app";
4983
+ const meilisearchApiKey = options?.meilisearch?.apiKey || typeof process !== "undefined" && process.env?.NEXT_PUBLIC_MEILISEARCH_API_KEY || "eee819b849798ad9091228c486ec05d0931e5292";
4984
+ const designsIndex = options?.meilisearch?.designsIndex || typeof process !== "undefined" && process.env?.NEXT_PUBLIC_MEILISEARCH_DESIGNS_INDEX || "snowcone-designs";
4985
+ const headers = {
4986
+ "Content-Type": "application/json"
4987
+ };
4988
+ if (meilisearchApiKey) {
4989
+ headers["Authorization"] = `Bearer ${meilisearchApiKey}`;
4990
+ }
4991
+ const url = `${meilisearchHost}/indexes/${designsIndex}/search`;
4992
+ const res = await f(url, {
4993
+ method: "POST",
4994
+ headers,
4995
+ body: JSON.stringify({
4996
+ q: query,
4997
+ limit: options?.limit || 50,
4998
+ ...options?.offset ? { offset: options.offset } : {},
4999
+ ...options?.filter ? { filter: options.filter } : {}
5000
+ })
5001
+ });
5002
+ if (!res.ok) throw new Error(`searchDesigns failed: ${res.status}`);
5003
+ const data = await res.json();
5004
+ const items = data.hits || [];
5005
+ return { items, total: data.estimatedTotalHits || items.length };
5006
+ }
4980
5007
  function createClient(config) {
4981
5008
  const fetcher = getFetcher(config);
4982
5009
  const mockupService = new MockupServiceImpl(config.mockup || {}, fetcher);
4983
5010
  return {
4984
5011
  catalog: {
4985
5012
  listProducts: (overrides) => listProducts({ ...config, ...overrides }),
4986
- getProduct: (idOrSlug, overrides) => getProduct(idOrSlug, { ...config, ...overrides })
5013
+ getProduct: (idOrSlug, overrides) => getProduct(idOrSlug, { ...config, ...overrides }),
5014
+ designs: {
5015
+ search: (query, options) => searchDesigns(query, { ...config, ...options })
5016
+ }
4987
5017
  },
4988
5018
  mockup: mockupService
4989
5019
  };
@@ -5105,6 +5135,7 @@ export {
5105
5135
  resolveMockupId,
5106
5136
  resolveVariantId,
5107
5137
  retryOperation,
5138
+ searchDesigns,
5108
5139
  simulateCartOperation,
5109
5140
  toCombinations,
5110
5141
  toOptionAttributes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowcone-app/sdk",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "description": "Snowcone SDK for product mockups and print-on-demand",
5
5
  "keywords": [
6
6
  "merch",