@snowcone-app/sdk 0.27.1 → 0.28.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 +6 -0
- package/dist/index.cjs +17 -0
- package/dist/index.d.cts +30 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +15 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.28.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#4540](https://github.com/snowcone-app/snowcone-monorepo/pull/4540) [`275d964`](https://github.com/snowcone-app/snowcone-monorepo/commit/275d964b1fbbae1bfbf37094fc9be2edfedcbe3c) Thanks [@kevinsproles](https://github.com/kevinsproles)! - `PDP_GALLERY_LIMIT` (the product page gallery's one limit, 10) and `galleryStanding(mockups, id)`: a picture's position among the ordinary pictures, whether a shopper sees it, and why (`reason`: shown | past-limit | when-size-chosen | never-shown | not-published), computed from the published order.
|
|
8
|
+
|
|
3
9
|
## 0.27.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -49,6 +49,7 @@ __export(index_exports, {
|
|
|
49
49
|
Focus: () => Focus,
|
|
50
50
|
LifecycleManager: () => LifecycleManager,
|
|
51
51
|
LitAdapter: () => LitAdapter,
|
|
52
|
+
PDP_GALLERY_LIMIT: () => PDP_GALLERY_LIMIT,
|
|
52
53
|
ProductContextManager: () => ProductContextManager,
|
|
53
54
|
ProductLoader: () => ProductLoader,
|
|
54
55
|
ProductProps: () => ProductProps,
|
|
@@ -113,6 +114,7 @@ __export(index_exports, {
|
|
|
113
114
|
formatPrice: () => formatPrice,
|
|
114
115
|
formatValidationErrors: () => formatValidationErrors,
|
|
115
116
|
gallerySizePicture: () => gallerySizePicture,
|
|
117
|
+
galleryStanding: () => galleryStanding,
|
|
116
118
|
getBuyUrl: () => getBuyUrl,
|
|
117
119
|
getDefaultVariantId: () => getDefaultVariantId,
|
|
118
120
|
getEffectiveAlignment: () => getEffectiveAlignment,
|
|
@@ -1088,6 +1090,19 @@ function mockupRole(m) {
|
|
|
1088
1090
|
function ordinaryMockups(mockups) {
|
|
1089
1091
|
return (mockups ?? []).filter((m) => mockupRole(m) === "ordinary");
|
|
1090
1092
|
}
|
|
1093
|
+
var PDP_GALLERY_LIMIT = 10;
|
|
1094
|
+
function galleryStanding(mockups, mockupId) {
|
|
1095
|
+
const ordinary = ordinaryMockups(mockups);
|
|
1096
|
+
const base = { count: ordinary.length, limit: PDP_GALLERY_LIMIT };
|
|
1097
|
+
const i = ordinary.findIndex((m2) => m2.id === mockupId);
|
|
1098
|
+
if (i >= 0) {
|
|
1099
|
+
const shown = i < PDP_GALLERY_LIMIT;
|
|
1100
|
+
return { ...base, position: i + 1, shown, reason: shown ? "shown" : "past-limit" };
|
|
1101
|
+
}
|
|
1102
|
+
const m = (mockups ?? []).find((x) => x.id === mockupId);
|
|
1103
|
+
const reason = !m ? "not-published" : mockupRole(m) === SIZE_PICTURE ? "when-size-chosen" : "never-shown";
|
|
1104
|
+
return { ...base, position: null, shown: false, reason };
|
|
1105
|
+
}
|
|
1091
1106
|
function pictureForVariant(mockups, variantId) {
|
|
1092
1107
|
const ordinary = ordinaryMockups(mockups);
|
|
1093
1108
|
if (variantId) {
|
|
@@ -6654,6 +6669,7 @@ function createClient(config) {
|
|
|
6654
6669
|
Focus,
|
|
6655
6670
|
LifecycleManager,
|
|
6656
6671
|
LitAdapter,
|
|
6672
|
+
PDP_GALLERY_LIMIT,
|
|
6657
6673
|
ProductContextManager,
|
|
6658
6674
|
ProductLoader,
|
|
6659
6675
|
ProductProps,
|
|
@@ -6718,6 +6734,7 @@ function createClient(config) {
|
|
|
6718
6734
|
formatPrice,
|
|
6719
6735
|
formatValidationErrors,
|
|
6720
6736
|
gallerySizePicture,
|
|
6737
|
+
galleryStanding,
|
|
6721
6738
|
getBuyUrl,
|
|
6722
6739
|
getDefaultVariantId,
|
|
6723
6740
|
getEffectiveAlignment,
|
package/dist/index.d.cts
CHANGED
|
@@ -507,6 +507,35 @@ type OrdinaryMockups<T> = readonly T[] & {
|
|
|
507
507
|
readonly [ORDINARY]: true;
|
|
508
508
|
};
|
|
509
509
|
declare function ordinaryMockups<T extends WithRole>(mockups: readonly T[] | null | undefined): OrdinaryMockups<T>;
|
|
510
|
+
/**
|
|
511
|
+
* How many ordinary pictures the product page's gallery shows: the ONE number www slices with and every staff tool
|
|
512
|
+
* reads to say whether a shopper can see a picture (loom /merch/live: "position 21: not shown, the store shows the
|
|
513
|
+
* first 10"). Never redeclare it locally: a test in www refuses a local gallery limit.
|
|
514
|
+
*/
|
|
515
|
+
declare const PDP_GALLERY_LIMIT = 10;
|
|
516
|
+
/**
|
|
517
|
+
* Why a picture is or is not in front of a shopper, in one word a staff page can turn into a sentence:
|
|
518
|
+
* - `shown`: an ordinary picture within the first PDP_GALLERY_LIMIT;
|
|
519
|
+
* - `past-limit`: an ordinary picture after them (published, but no shopper sees it);
|
|
520
|
+
* - `when-size-chosen`: a size picture: not ranked, shown LAST in the gallery when its size is chosen (one per size);
|
|
521
|
+
* - `never-shown`: any other mark (e.g. 'size-picture-released'): never in the gallery;
|
|
522
|
+
* - `not-published`: not in the published list at all (hidden, or gone).
|
|
523
|
+
*/
|
|
524
|
+
type GalleryReason = "shown" | "past-limit" | "when-size-chosen" | "never-shown" | "not-published";
|
|
525
|
+
/** Where a picture stands in the shopper's gallery, COMPUTED from the published order (never asserted). */
|
|
526
|
+
interface GalleryStanding {
|
|
527
|
+
/** 1-based position among the ordinary pictures; null for anything that is not an ordinary published picture. */
|
|
528
|
+
position: number | null;
|
|
529
|
+
/** How many ordinary pictures the product has. */
|
|
530
|
+
count: number;
|
|
531
|
+
/** In the ranked gallery a shopper sees by default (reason 'shown'). A size picture is false here: see `reason`. */
|
|
532
|
+
shown: boolean;
|
|
533
|
+
reason: GalleryReason;
|
|
534
|
+
limit: typeof PDP_GALLERY_LIMIT;
|
|
535
|
+
}
|
|
536
|
+
/** `mockups` = the published record's list in gallery order (the catalog's GET /catalog/products/:id, which applies
|
|
537
|
+
* json.mockupOrder): the same list the product page slices. */
|
|
538
|
+
declare function galleryStanding(mockups: readonly WithRole[] | null | undefined, mockupId: string): GalleryStanding;
|
|
510
539
|
/**
|
|
511
540
|
* The picture for a variant: the first ordinary mockup that lists it, else the product's first ordinary mockup (its
|
|
512
541
|
* fallback picture), else null. Never a size picture, even when a size picture is the only mockup listing the variant.
|
|
@@ -3486,4 +3515,4 @@ declare function searchDesigns(query?: string, options?: SearchDesignsOptions):
|
|
|
3486
3515
|
*/
|
|
3487
3516
|
declare function createClient(config: SdkConfig): SnowconeClient;
|
|
3488
3517
|
|
|
3489
|
-
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 FailedAsset, type FetchMockupImageOptions, type Fill, Focus, FrameworkAdapter, FrameworkUtilities, type GetMockupUrlOptions, type ImageAlignment, type ImageDesignElement, type LifecycleHook, LifecycleManager, type LifecyclePhase, type LifecycleTransition, LitAdapter, type MaskOverride, type MockupGenerationOptions, type MockupImage, MockupResult, type MockupRole, type MockupService, type MockupServiceConfig, OptionAttribute, type OptionChoice, type OptionChoiceRenderData, type OptionRenderData, OptionSelection, type OrdinaryMockups, 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, RealtimeRenderError, type RegularArtwork, type RenderProduct, type RenderProductAttribute, type RenderProductAttributeChoice, type RenderProductCombination, type RenderProductMockup, type RenderProductOptions, type RenderProductRequiredPlacement, RenderSession, type RenderSessionOptions, type RenderState, SIZE_PICTURE, type SdkConfig, type SeamlessPattern, type SearchDesignsOptions, type SignedUrlResponse, type SnowconeClient, SnowconeSdkError, type SnowconeSdkErrorCode, 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, fetchMockupImage, fetchRealtimeGrant, filterImagePlacements, findClosestSnapPoint, findVariantForSelection, formatPrice, formatValidationErrors, gallerySizePicture, getBuyUrl, getDefaultVariantId, getEffectiveAlignment, getIncompleteSelectionMessage, getMissingSelections, getMockupUrl, getOptionRenderType, getProduct, getSelectionDisplayText, getSnapPoints, getVariant, handleOptionChange, imageKindOf, isSelectionComplete, isSnowconeSdkError, isValidAlignment, isValidTileCount, listProducts, mintRealtimeGrant, mockupRole, mockupUrl, normalizeChoice, ordinaryMockups, pictureForVariant, prepareOptionRenderData, primaryMockup, registerStandardComponents, resolveMockupId, resolvePreviewVariantId, resolveVariantId, retryOperation, searchDesigns, simulateCartOperation, toCombinations, toOptionAttributes, useFrameworkAdapter as useVueAdapter, validateAlignment, validateDesignElement, validateEffects, validateImageUrl, validateMockupOptions, validateProductSelection, validateProductSpec, validateRequiredOptions, validateTileCount, warnVariantNotSelected, withContext, withErrorHandling, withSyncErrorHandling };
|
|
3518
|
+
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 FailedAsset, type FetchMockupImageOptions, type Fill, Focus, FrameworkAdapter, FrameworkUtilities, type GalleryReason, type GalleryStanding, type GetMockupUrlOptions, type ImageAlignment, type ImageDesignElement, type LifecycleHook, LifecycleManager, type LifecyclePhase, type LifecycleTransition, LitAdapter, type MaskOverride, type MockupGenerationOptions, type MockupImage, MockupResult, type MockupRole, type MockupService, type MockupServiceConfig, OptionAttribute, type OptionChoice, type OptionChoiceRenderData, type OptionRenderData, OptionSelection, type OrdinaryMockups, PDP_GALLERY_LIMIT, 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, RealtimeRenderError, type RegularArtwork, type RenderProduct, type RenderProductAttribute, type RenderProductAttributeChoice, type RenderProductCombination, type RenderProductMockup, type RenderProductOptions, type RenderProductRequiredPlacement, RenderSession, type RenderSessionOptions, type RenderState, SIZE_PICTURE, type SdkConfig, type SeamlessPattern, type SearchDesignsOptions, type SignedUrlResponse, type SnowconeClient, SnowconeSdkError, type SnowconeSdkErrorCode, 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, fetchMockupImage, fetchRealtimeGrant, filterImagePlacements, findClosestSnapPoint, findVariantForSelection, formatPrice, formatValidationErrors, gallerySizePicture, galleryStanding, getBuyUrl, getDefaultVariantId, getEffectiveAlignment, getIncompleteSelectionMessage, getMissingSelections, getMockupUrl, getOptionRenderType, getProduct, getSelectionDisplayText, getSnapPoints, getVariant, handleOptionChange, imageKindOf, isSelectionComplete, isSnowconeSdkError, isValidAlignment, isValidTileCount, listProducts, mintRealtimeGrant, mockupRole, mockupUrl, normalizeChoice, ordinaryMockups, pictureForVariant, prepareOptionRenderData, primaryMockup, registerStandardComponents, resolveMockupId, resolvePreviewVariantId, 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
|
@@ -507,6 +507,35 @@ type OrdinaryMockups<T> = readonly T[] & {
|
|
|
507
507
|
readonly [ORDINARY]: true;
|
|
508
508
|
};
|
|
509
509
|
declare function ordinaryMockups<T extends WithRole>(mockups: readonly T[] | null | undefined): OrdinaryMockups<T>;
|
|
510
|
+
/**
|
|
511
|
+
* How many ordinary pictures the product page's gallery shows: the ONE number www slices with and every staff tool
|
|
512
|
+
* reads to say whether a shopper can see a picture (loom /merch/live: "position 21: not shown, the store shows the
|
|
513
|
+
* first 10"). Never redeclare it locally: a test in www refuses a local gallery limit.
|
|
514
|
+
*/
|
|
515
|
+
declare const PDP_GALLERY_LIMIT = 10;
|
|
516
|
+
/**
|
|
517
|
+
* Why a picture is or is not in front of a shopper, in one word a staff page can turn into a sentence:
|
|
518
|
+
* - `shown`: an ordinary picture within the first PDP_GALLERY_LIMIT;
|
|
519
|
+
* - `past-limit`: an ordinary picture after them (published, but no shopper sees it);
|
|
520
|
+
* - `when-size-chosen`: a size picture: not ranked, shown LAST in the gallery when its size is chosen (one per size);
|
|
521
|
+
* - `never-shown`: any other mark (e.g. 'size-picture-released'): never in the gallery;
|
|
522
|
+
* - `not-published`: not in the published list at all (hidden, or gone).
|
|
523
|
+
*/
|
|
524
|
+
type GalleryReason = "shown" | "past-limit" | "when-size-chosen" | "never-shown" | "not-published";
|
|
525
|
+
/** Where a picture stands in the shopper's gallery, COMPUTED from the published order (never asserted). */
|
|
526
|
+
interface GalleryStanding {
|
|
527
|
+
/** 1-based position among the ordinary pictures; null for anything that is not an ordinary published picture. */
|
|
528
|
+
position: number | null;
|
|
529
|
+
/** How many ordinary pictures the product has. */
|
|
530
|
+
count: number;
|
|
531
|
+
/** In the ranked gallery a shopper sees by default (reason 'shown'). A size picture is false here: see `reason`. */
|
|
532
|
+
shown: boolean;
|
|
533
|
+
reason: GalleryReason;
|
|
534
|
+
limit: typeof PDP_GALLERY_LIMIT;
|
|
535
|
+
}
|
|
536
|
+
/** `mockups` = the published record's list in gallery order (the catalog's GET /catalog/products/:id, which applies
|
|
537
|
+
* json.mockupOrder): the same list the product page slices. */
|
|
538
|
+
declare function galleryStanding(mockups: readonly WithRole[] | null | undefined, mockupId: string): GalleryStanding;
|
|
510
539
|
/**
|
|
511
540
|
* The picture for a variant: the first ordinary mockup that lists it, else the product's first ordinary mockup (its
|
|
512
541
|
* fallback picture), else null. Never a size picture, even when a size picture is the only mockup listing the variant.
|
|
@@ -3486,4 +3515,4 @@ declare function searchDesigns(query?: string, options?: SearchDesignsOptions):
|
|
|
3486
3515
|
*/
|
|
3487
3516
|
declare function createClient(config: SdkConfig): SnowconeClient;
|
|
3488
3517
|
|
|
3489
|
-
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 FailedAsset, type FetchMockupImageOptions, type Fill, Focus, FrameworkAdapter, FrameworkUtilities, type GetMockupUrlOptions, type ImageAlignment, type ImageDesignElement, type LifecycleHook, LifecycleManager, type LifecyclePhase, type LifecycleTransition, LitAdapter, type MaskOverride, type MockupGenerationOptions, type MockupImage, MockupResult, type MockupRole, type MockupService, type MockupServiceConfig, OptionAttribute, type OptionChoice, type OptionChoiceRenderData, type OptionRenderData, OptionSelection, type OrdinaryMockups, 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, RealtimeRenderError, type RegularArtwork, type RenderProduct, type RenderProductAttribute, type RenderProductAttributeChoice, type RenderProductCombination, type RenderProductMockup, type RenderProductOptions, type RenderProductRequiredPlacement, RenderSession, type RenderSessionOptions, type RenderState, SIZE_PICTURE, type SdkConfig, type SeamlessPattern, type SearchDesignsOptions, type SignedUrlResponse, type SnowconeClient, SnowconeSdkError, type SnowconeSdkErrorCode, 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, fetchMockupImage, fetchRealtimeGrant, filterImagePlacements, findClosestSnapPoint, findVariantForSelection, formatPrice, formatValidationErrors, gallerySizePicture, getBuyUrl, getDefaultVariantId, getEffectiveAlignment, getIncompleteSelectionMessage, getMissingSelections, getMockupUrl, getOptionRenderType, getProduct, getSelectionDisplayText, getSnapPoints, getVariant, handleOptionChange, imageKindOf, isSelectionComplete, isSnowconeSdkError, isValidAlignment, isValidTileCount, listProducts, mintRealtimeGrant, mockupRole, mockupUrl, normalizeChoice, ordinaryMockups, pictureForVariant, prepareOptionRenderData, primaryMockup, registerStandardComponents, resolveMockupId, resolvePreviewVariantId, resolveVariantId, retryOperation, searchDesigns, simulateCartOperation, toCombinations, toOptionAttributes, useFrameworkAdapter as useVueAdapter, validateAlignment, validateDesignElement, validateEffects, validateImageUrl, validateMockupOptions, validateProductSelection, validateProductSpec, validateRequiredOptions, validateTileCount, warnVariantNotSelected, withContext, withErrorHandling, withSyncErrorHandling };
|
|
3518
|
+
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 FailedAsset, type FetchMockupImageOptions, type Fill, Focus, FrameworkAdapter, FrameworkUtilities, type GalleryReason, type GalleryStanding, type GetMockupUrlOptions, type ImageAlignment, type ImageDesignElement, type LifecycleHook, LifecycleManager, type LifecyclePhase, type LifecycleTransition, LitAdapter, type MaskOverride, type MockupGenerationOptions, type MockupImage, MockupResult, type MockupRole, type MockupService, type MockupServiceConfig, OptionAttribute, type OptionChoice, type OptionChoiceRenderData, type OptionRenderData, OptionSelection, type OrdinaryMockups, PDP_GALLERY_LIMIT, 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, RealtimeRenderError, type RegularArtwork, type RenderProduct, type RenderProductAttribute, type RenderProductAttributeChoice, type RenderProductCombination, type RenderProductMockup, type RenderProductOptions, type RenderProductRequiredPlacement, RenderSession, type RenderSessionOptions, type RenderState, SIZE_PICTURE, type SdkConfig, type SeamlessPattern, type SearchDesignsOptions, type SignedUrlResponse, type SnowconeClient, SnowconeSdkError, type SnowconeSdkErrorCode, 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, fetchMockupImage, fetchRealtimeGrant, filterImagePlacements, findClosestSnapPoint, findVariantForSelection, formatPrice, formatValidationErrors, gallerySizePicture, galleryStanding, getBuyUrl, getDefaultVariantId, getEffectiveAlignment, getIncompleteSelectionMessage, getMissingSelections, getMockupUrl, getOptionRenderType, getProduct, getSelectionDisplayText, getSnapPoints, getVariant, handleOptionChange, imageKindOf, isSelectionComplete, isSnowconeSdkError, isValidAlignment, isValidTileCount, listProducts, mintRealtimeGrant, mockupRole, mockupUrl, normalizeChoice, ordinaryMockups, pictureForVariant, prepareOptionRenderData, primaryMockup, registerStandardComponents, resolveMockupId, resolvePreviewVariantId, 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
|
@@ -646,6 +646,19 @@ function mockupRole(m) {
|
|
|
646
646
|
function ordinaryMockups(mockups) {
|
|
647
647
|
return (mockups ?? []).filter((m) => mockupRole(m) === "ordinary");
|
|
648
648
|
}
|
|
649
|
+
var PDP_GALLERY_LIMIT = 10;
|
|
650
|
+
function galleryStanding(mockups, mockupId) {
|
|
651
|
+
const ordinary = ordinaryMockups(mockups);
|
|
652
|
+
const base = { count: ordinary.length, limit: PDP_GALLERY_LIMIT };
|
|
653
|
+
const i = ordinary.findIndex((m2) => m2.id === mockupId);
|
|
654
|
+
if (i >= 0) {
|
|
655
|
+
const shown = i < PDP_GALLERY_LIMIT;
|
|
656
|
+
return { ...base, position: i + 1, shown, reason: shown ? "shown" : "past-limit" };
|
|
657
|
+
}
|
|
658
|
+
const m = (mockups ?? []).find((x) => x.id === mockupId);
|
|
659
|
+
const reason = !m ? "not-published" : mockupRole(m) === SIZE_PICTURE ? "when-size-chosen" : "never-shown";
|
|
660
|
+
return { ...base, position: null, shown: false, reason };
|
|
661
|
+
}
|
|
649
662
|
function pictureForVariant(mockups, variantId) {
|
|
650
663
|
const ordinary = ordinaryMockups(mockups);
|
|
651
664
|
if (variantId) {
|
|
@@ -5226,6 +5239,7 @@ export {
|
|
|
5226
5239
|
Focus,
|
|
5227
5240
|
LifecycleManager,
|
|
5228
5241
|
LitAdapter,
|
|
5242
|
+
PDP_GALLERY_LIMIT,
|
|
5229
5243
|
ProductContextManager,
|
|
5230
5244
|
ProductLoader,
|
|
5231
5245
|
ProductProps,
|
|
@@ -5290,6 +5304,7 @@ export {
|
|
|
5290
5304
|
formatPrice,
|
|
5291
5305
|
formatValidationErrors,
|
|
5292
5306
|
gallerySizePicture,
|
|
5307
|
+
galleryStanding,
|
|
5293
5308
|
getBuyUrl,
|
|
5294
5309
|
getDefaultVariantId,
|
|
5295
5310
|
getEffectiveAlignment,
|