@cimplify/sdk 0.57.0 → 0.58.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.
@@ -1,5 +1,42 @@
1
1
  'use strict';
2
2
 
3
+ // src/gallery.ts
4
+ function dedupe(urls) {
5
+ const seen = /* @__PURE__ */ new Set();
6
+ const out = [];
7
+ for (const url of urls) {
8
+ if (url && !seen.has(url)) {
9
+ seen.add(url);
10
+ out.push(url);
11
+ }
12
+ }
13
+ return out;
14
+ }
15
+ function resolveGallery(product, selectedVariantId) {
16
+ const variant = selectedVariantId ? product.variants?.find((v) => v.id === selectedVariantId) : void 0;
17
+ if (variant?.images?.length) return dedupe(variant.images);
18
+ if (product.images?.length) return dedupe(product.images);
19
+ const firstWithImages = product.variants?.find((v) => v.images?.length);
20
+ if (firstWithImages?.images?.length) return dedupe(firstWithImages.images);
21
+ return product.image_url ? [product.image_url] : [];
22
+ }
23
+ function allGalleryImages(product) {
24
+ const seen = /* @__PURE__ */ new Set();
25
+ const out = [];
26
+ const push = (url, variantId) => {
27
+ if (url && !seen.has(url)) {
28
+ seen.add(url);
29
+ out.push({ url, variantId });
30
+ }
31
+ };
32
+ push(product.image_url, null);
33
+ for (const url of product.images ?? []) push(url, null);
34
+ for (const variant of product.variants ?? []) {
35
+ for (const url of variant.images ?? []) push(url, variant.id);
36
+ }
37
+ return out;
38
+ }
39
+
3
40
  // src/utils/variant.ts
4
41
  function stripProductPrefix(variantName, productName) {
5
42
  if (!variantName || !productName) return variantName || productName;
@@ -264,9 +301,11 @@ exports.DURATION_UNIT = DURATION_UNIT;
264
301
  exports.INPUT_FIELD_TYPE = INPUT_FIELD_TYPE;
265
302
  exports.PRODUCT_TYPE = PRODUCT_TYPE;
266
303
  exports.RENDER_HINT = RENDER_HINT;
304
+ exports.allGalleryImages = allGalleryImages;
267
305
  exports.assetUrl = assetUrl;
268
306
  exports.generatePkce = generatePkce;
269
307
  exports.generateState = generateState;
270
308
  exports.getVariantDisplayName = getVariantDisplayName;
271
309
  exports.isCimplifyAsset = isCimplifyAsset;
310
+ exports.resolveGallery = resolveGallery;
272
311
  exports.startSignIn = startSignIn;
@@ -1,3 +1,40 @@
1
+ // src/gallery.ts
2
+ function dedupe(urls) {
3
+ const seen = /* @__PURE__ */ new Set();
4
+ const out = [];
5
+ for (const url of urls) {
6
+ if (url && !seen.has(url)) {
7
+ seen.add(url);
8
+ out.push(url);
9
+ }
10
+ }
11
+ return out;
12
+ }
13
+ function resolveGallery(product, selectedVariantId) {
14
+ const variant = selectedVariantId ? product.variants?.find((v) => v.id === selectedVariantId) : void 0;
15
+ if (variant?.images?.length) return dedupe(variant.images);
16
+ if (product.images?.length) return dedupe(product.images);
17
+ const firstWithImages = product.variants?.find((v) => v.images?.length);
18
+ if (firstWithImages?.images?.length) return dedupe(firstWithImages.images);
19
+ return product.image_url ? [product.image_url] : [];
20
+ }
21
+ function allGalleryImages(product) {
22
+ const seen = /* @__PURE__ */ new Set();
23
+ const out = [];
24
+ const push = (url, variantId) => {
25
+ if (url && !seen.has(url)) {
26
+ seen.add(url);
27
+ out.push({ url, variantId });
28
+ }
29
+ };
30
+ push(product.image_url, null);
31
+ for (const url of product.images ?? []) push(url, null);
32
+ for (const variant of product.variants ?? []) {
33
+ for (const url of variant.images ?? []) push(url, variant.id);
34
+ }
35
+ return out;
36
+ }
37
+
1
38
  // src/utils/variant.ts
2
39
  function stripProductPrefix(variantName, productName) {
3
40
  if (!variantName || !productName) return variantName || productName;
@@ -256,4 +293,4 @@ function appendTransform(url, t) {
256
293
  return `${url}${url.includes("?") ? "&" : "?"}${query}`;
257
294
  }
258
295
 
259
- export { CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, assetUrl, generatePkce, generateState, getVariantDisplayName, isCimplifyAsset, startSignIn };
296
+ export { CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, allGalleryImages, assetUrl, generatePkce, generateState, getVariantDisplayName, isCimplifyAsset, resolveGallery, startSignIn };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { A as AUTHORIZATION_TYPE, a as AUTH_MUTATION, b as AbortablePromise, c as ActivityRecommendation, d as ActivityRecommendationsResponse, e as ActivityService, f as ActivityStateResponse, g as AddressData, h as AddressInfo, i as AmountToPay, j as AuthResponse, k as AuthService, l as AuthStatus, m as AuthenticatedCustomer, n as AuthenticatedData, o as AutocompletePrediction, p as AutocompleteResponse, q as AvailabilityResult, r as AvailableSlot, B as Booking, s as BookingModificationType, t as BookingStatus, u as BookingWithDetails, v as BufferTimes, w as Business, x as BusinessHours, y as BusinessPreferences, z as BusinessService, C as BusinessSettings, D as BusinessType, E as BusinessWithLocations, F as CHECKOUT_MODE, G as CHECKOUT_MUTATION, H as CHECKOUT_STEP, I as CONTACT_TYPE, J as CacheOptions, K as CancelBookingInput, L as CancelBookingResult, M as CancelOrderInput, N as CancellationPolicy, O as CartOperations, P as CatalogueQueries, Q as CatalogueResult, R as CatalogueSnapshot, S as CategoryInfo, T as ChatAttachment, U as ChatConversation, V as ChatConversationResponse, W as ChatMessage, X as ChatWidgetStarter, Y as CheckSlotAvailabilityInput, Z as CheckSlotAvailabilityResult, _ as CheckoutAddressInfo, $ as CheckoutCartData, a0 as CheckoutCartItem, a1 as CheckoutCustomerInfo, a2 as CheckoutFormData, a3 as CheckoutInput, a4 as CheckoutMode, a8 as CheckoutOperations, a5 as CheckoutOrderType, a6 as CheckoutPaymentMethod, a7 as CheckoutResult, a8 as CheckoutService, a9 as CheckoutStatus, aa as CheckoutStatusContext, ab as CheckoutStep, ac as CimplifyClient, ad as CimplifyConfig, ae as CimplifyElement, af as CimplifyElements, ag as ContactType, ah as ContentType, ai as CreateAddressInput, aj as CreateMobileMoneyInput, ak as Customer, al as CustomerAddress, am as CustomerBooking, an as CustomerBookingServiceItem, ao as CustomerLinkPreferences, ap as CustomerMobileMoney, aq as CustomerServicePreferences, ar as DEFAULT_COUNTRY, as as DEFAULT_CURRENCY, at as DEVICE_TYPE, au as DayAvailability, av as DeliveryFeeDetails, aw as DeliveryFeeResponse, ax as DeliveryService, ay as DepositResult, az as DeviceType, aA as DismissMessageResponse, aB as ELEMENT_TYPES, aC as EVENT_TYPES, aD as ElementAppearance, aE as ElementEventHandler, aF as ElementEventType, aG as ElementOptions, aH as ElementType, aI as ElementsCheckoutData, aJ as ElementsCheckoutResult, aK as ElementsCustomerInfo, aL as ElementsOptions, aM as EnrollAndLinkOrderInput, aN as EnrollAndLinkOrderResult, aO as EnrollmentData, aP as Err, aQ as FeeBearerType, aR as FetchQuoteInput, aS as FulfillmentLink, aT as FulfillmentStatus, aU as FulfillmentType, aV as FxQuote, aW as FxQuoteRequest, aX as FxRateResponse, aY as FxService, aZ as GetAvailableSlotsInput, a_ as GetOrdersOptions, a$ as GetProductsOptions, b0 as IframeToParentMessage, b1 as InventoryService, b2 as LINK_MUTATION, b3 as LINK_QUERY, b4 as LineItem, b5 as LineType, b6 as LinkData, b7 as LinkEnrollResult, b8 as LinkService, b9 as LinkSession, ba as LinkStatusResult, bb as LiteBootstrap, bc as LiteService, bd as Location, be as LocationBooking, bf as LocationTaxBehavior, bg as LocationTaxOverrides, bh as LocationTimeProfile, bi as LocationWithDetails, bj as MESSAGE_TYPES, bk as MOBILE_MONEY_PROVIDER, bl as MobileMoneyData, bm as MobileMoneyDetails, bn as MobileMoneyProvider, bo as NextAction, bp as ORDER_MUTATION, bq as ORDER_TYPE, br as ObservabilityHooks, bs as Ok, bt as Order, bu as OrderChannel, bv as OrderFilter, bw as OrderFulfillmentSummary, bx as OrderGroup, by as OrderGroupDetails, bz as OrderGroupPayment, bA as OrderGroupPaymentState, bB as OrderGroupPaymentStatus, bC as OrderGroupPaymentSummary, bD as OrderGroupStatus, bE as OrderHistory, bF as OrderLineState, bG as OrderLineStatus, bH as OrderPaymentEvent, bI as OrderQueries, bJ as OrderSplitDetail, bK as OrderStatus, bL as OrderType, bM as OtpResult, bN as PAYMENT_METHOD, bO as PAYMENT_MUTATION, bP as PAYMENT_STATE, bQ as PICKUP_TIME_TYPE, bR as ParentToIframeMessage, bS as PaymentMethodInfo, bT as PaymentState, bU as PickupTime, bV as PickupTimeType, bW as PlaceDetailsResponse, bX as PlacesService, bY as PriceQuote, bZ as PricingOverrides, b_ as ProcessAndResolveOptions, b$ as ProcessCheckoutOptions, c0 as ProcessCheckoutResult, c1 as ProviderResolutionSource, c2 as QuoteBundleSelectionInput, c3 as QuoteCompositeSelectionInput, c4 as QuoteDynamicBuckets, c5 as QuoteStatus, c6 as QuoteUiMessage, c7 as ReadRequestOptions, c8 as RefreshQuoteInput, c9 as RefreshQuoteResult, ca as RefundOrderInput, cb as RelatedCandidate, cc as RelatedProduct, cd as RelatedProductsEnrichment, ce as RelationType, cf as ReminderMethod, cg as ReminderSettings, ch as ReorderResult, ci as RequestContext, cj as RequestErrorEvent, ck as RequestOptions, cl as RequestOtpInput, cm as RequestSource, cn as RequestStartEvent, co as RequestSuccessEvent, cp as RescheduleBookingInput, cq as RescheduleBookingResult, cr as RescheduleHistoryRecord, cs as ResourceAssignment, ct as Result, cu as RetryEvent, cv as RevokeAllSessionsResult, cw as RevokeSessionResult, cx as Room, cy as SchedulingMetadata, cz as SchedulingResult, cA as SchedulingService, cB as SenderType, cC as Service, cD as ServiceAvailabilityParams, cE as ServiceAvailabilityResult, cF as ServiceCharge, cG as ServiceNotes, cH as ServiceScheduleRequest, cI as ServiceStatus, cJ as SessionActivityData, cK as SessionChangeEvent, cL as SessionMessage, cM as SlotResourceInfo, cN as SlotStaffInfo, cO as Staff, cP as StaffAssignment, cQ as StaffRole, cR as StaffScheduleItem, cS as StockLevel, cT as StockStatus, cU as StorefrontBootstrap, cV as SubscriptionService, cW as SupportService, cX as Table, cY as TableInfo, cZ as TimeRange, c_ as TimeRanges, c$ as TimeSlot, d0 as TrackCategoryViewOptions, d1 as TrackProductViewOptions, d2 as UpdateAddressInput, d3 as UpdateOrderStatusInput, d4 as UpdateProfileInput, d5 as UploadInitResponse, d6 as UploadResult, d7 as UploadService, d8 as VerifyOtpInput, d9 as combine, da as combineObject, db as createCimplifyClient, dc as createElements, dd as err, de as flatMap, df as fromPromise, dg as getOrElse, dh as isErr, di as isOk, dj as mapError, dk as mapResult, dl as ok, dm as toNullable, dn as tryCatch, dp as unwrap } from './client-DKg-5OWu.mjs';
2
- import { j as ApiError } from './product-B_kS4Oxa.mjs';
3
- export { A as AddOn, a as AddOnDetails, b as AddOnGroupDetails, c as AddOnOption, d as AddOnOptionDetails, e as AddOnOptionPrice, f as AddOnWithOptions, g as AddToCartInput, h as AddressValue, i as AdjustmentType, k as AppliedDiscount, l as AttributeAppliesTo, m as AttributeType, n as AttributeValidationRules, o as AttributeVisibility, B as BenefitType, p as BillingFrequency, q as BillingMarkupType, r as BillingPlanType, s as Bundle, t as BundleComponentData, u as BundleComponentInfo, v as BundleComponentVariantView, w as BundleComponentView, x as BundlePriceType, y as BundleProduct, z as BundleSelectionData, C as BundleSelectionInput, D as BundleStoredSelection, E as BundleSummary, F as BundleWithDetails, G as Cart, H as CartAddOn, I as CartChannel, J as CartItem, K as CartItemDetails, L as CartMutationResult, M as CartNotice, N as CartStatus, O as CartSummary, P as CartTotals, Q as Category, R as CategorySummary, S as ChosenPrice, T as CimplifyError, U as Collection, V as CollectionProduct, W as CollectionSummary, X as ComponentGroup, Y as ComponentGroupWithComponents, Z as ComponentPriceBreakdown, _ as ComponentSchedulingData, $ as ComponentSelectionInput, a0 as ComponentSourceType, a1 as Composite, a2 as CompositeComponent, a3 as CompositeComponentView, a4 as CompositeGroupView, a5 as CompositePriceBreakdown, a6 as CompositePriceResult, a7 as CompositePricingMode, a8 as CompositeSelectionData, $ as CompositeSelectionInput, a9 as CompositeStoredSelection, aa as CompositeWithDetails, ab as CurrencyCode, ac as CustomAttributeDefinition, ad as CustomAttributeValue, ae as CustomerInputValue, af as DURATION_UNIT, ag as DateRangeValue, ah as Deal, ai as DealBenefitType, aj as DepositType, ak as DigitalProductType, al as DiscountBreakdown, am as DiscountDetails, an as DiscountValidation, ao as DisplayAddOn, ap as DisplayAddOnOption, aq as DisplayCart, ar as DisplayCartItem, as as DisplayMode, at as DurationUnit, au as ERROR_HINTS, av as EligiblePlansQuery, aw as ErrorCode, ax as ErrorCodeType, ay as ErrorHint, az as FacetValue, aA as FormattedPlanOption, aB as GroupPricingBehavior, aC as INPUT_FIELD_TYPE, aD as IdempotencyMismatchError, aE as InputFieldType, aF as InputFieldValidation, aG as InventoryType, aH as KnowledgeArticle, aI as LineConfiguration, aJ as LocationProductPrice, aK as LocationValue, aL as MeasurementValue, aM as Money, aN as PRODUCT_TYPE, aO as Pagination, aP as PaginationParams, aQ as PhoneValue, aR as Price, aS as PriceAdjustment, aT as PriceDecisionPath, aU as PriceEntryType, aV as PricePathTaxInfo, aW as PriceSource, aX as Product, aY as ProductAddOn, aZ as ProductAvailability, a_ as ProductAvailabilityNow, a$ as ProductBillingPlan, b0 as ProductDealInfo, b1 as ProductInputField, b2 as ProductProperty, b3 as ProductRenderHint, b4 as ProductTaxonomy, b5 as ProductTimeProfile, b6 as ProductType, b7 as ProductVariant, b8 as ProductVariantValue, b9 as ProductWithDetails, ba as PropertyFacet, bb as PropertySource, bc as QuantityPricingTier, bd as RENDER_HINT, be as RelatedProductView, bf as SalesChannel, bg as SchedulingMode, bh as SelectedAddOnOption, bi as SemanticKind, bj as SignatureValue, bk as Subscription, bl as SubscriptionInvoice, bm as SubscriptionItem, bn as SubscriptionStatus, bo as SubscriptionWithDetails, bp as Tag, bq as TagsResponse, br as TaxPathComponent, bs as TaxonomyAttributeTemplate, bt as TaxonomyWithChildren, bu as UICart, bv as UICartBusiness, bw as UICartCustomer, bx as UICartLocation, by as UICartPricing, bz as UpdateCartItemInput, bA as VariantAxis, bB as VariantAxisSelection, bC as VariantAxisValue, bD as VariantAxisValueView, bE as VariantAxisView, bF as VariantAxisWithValues, bG as VariantDetails, bH as VariantDetailsDTO, bI as VariantDisplayAttribute, bJ as VariantLocationAvailability, bK as VariantStrategy, bL as VariantView, bM as ZERO, bN as currencyCode, bO as enrichError, bP as getErrorHint, bQ as isCimplifyError, bR as isIdempotencyMismatchError, bS as isQuoteConflictRequiringConsent, bT as isQuoteError, bU as isRetryableError, bV as isSupportedCurrency, bW as money, bX as moneyFromNumber } from './product-B_kS4Oxa.mjs';
2
+ import { b9 as ProductWithDetails, j as ApiError } from './product-B_kS4Oxa.mjs';
3
+ export { A as AddOn, a as AddOnDetails, b as AddOnGroupDetails, c as AddOnOption, d as AddOnOptionDetails, e as AddOnOptionPrice, f as AddOnWithOptions, g as AddToCartInput, h as AddressValue, i as AdjustmentType, k as AppliedDiscount, l as AttributeAppliesTo, m as AttributeType, n as AttributeValidationRules, o as AttributeVisibility, B as BenefitType, p as BillingFrequency, q as BillingMarkupType, r as BillingPlanType, s as Bundle, t as BundleComponentData, u as BundleComponentInfo, v as BundleComponentVariantView, w as BundleComponentView, x as BundlePriceType, y as BundleProduct, z as BundleSelectionData, C as BundleSelectionInput, D as BundleStoredSelection, E as BundleSummary, F as BundleWithDetails, G as Cart, H as CartAddOn, I as CartChannel, J as CartItem, K as CartItemDetails, L as CartMutationResult, M as CartNotice, N as CartStatus, O as CartSummary, P as CartTotals, Q as Category, R as CategorySummary, S as ChosenPrice, T as CimplifyError, U as Collection, V as CollectionProduct, W as CollectionSummary, X as ComponentGroup, Y as ComponentGroupWithComponents, Z as ComponentPriceBreakdown, _ as ComponentSchedulingData, $ as ComponentSelectionInput, a0 as ComponentSourceType, a1 as Composite, a2 as CompositeComponent, a3 as CompositeComponentView, a4 as CompositeGroupView, a5 as CompositePriceBreakdown, a6 as CompositePriceResult, a7 as CompositePricingMode, a8 as CompositeSelectionData, $ as CompositeSelectionInput, a9 as CompositeStoredSelection, aa as CompositeWithDetails, ab as CurrencyCode, ac as CustomAttributeDefinition, ad as CustomAttributeValue, ae as CustomerInputValue, af as DURATION_UNIT, ag as DateRangeValue, ah as Deal, ai as DealBenefitType, aj as DepositType, ak as DigitalProductType, al as DiscountBreakdown, am as DiscountDetails, an as DiscountValidation, ao as DisplayAddOn, ap as DisplayAddOnOption, aq as DisplayCart, ar as DisplayCartItem, as as DisplayMode, at as DurationUnit, au as ERROR_HINTS, av as EligiblePlansQuery, aw as ErrorCode, ax as ErrorCodeType, ay as ErrorHint, az as FacetValue, aA as FormattedPlanOption, aB as GroupPricingBehavior, aC as INPUT_FIELD_TYPE, aD as IdempotencyMismatchError, aE as InputFieldType, aF as InputFieldValidation, aG as InventoryType, aH as KnowledgeArticle, aI as LineConfiguration, aJ as LocationProductPrice, aK as LocationValue, aL as MeasurementValue, aM as Money, aN as PRODUCT_TYPE, aO as Pagination, aP as PaginationParams, aQ as PhoneValue, aR as Price, aS as PriceAdjustment, aT as PriceDecisionPath, aU as PriceEntryType, aV as PricePathTaxInfo, aW as PriceSource, aX as Product, aY as ProductAddOn, aZ as ProductAvailability, a_ as ProductAvailabilityNow, a$ as ProductBillingPlan, b0 as ProductDealInfo, b1 as ProductInputField, b2 as ProductProperty, b3 as ProductRenderHint, b4 as ProductTaxonomy, b5 as ProductTimeProfile, b6 as ProductType, b7 as ProductVariant, b8 as ProductVariantValue, ba as PropertyFacet, bb as PropertySource, bc as QuantityPricingTier, bd as RENDER_HINT, be as RelatedProductView, bf as SalesChannel, bg as SchedulingMode, bh as SelectedAddOnOption, bi as SemanticKind, bj as SignatureValue, bk as Subscription, bl as SubscriptionInvoice, bm as SubscriptionItem, bn as SubscriptionStatus, bo as SubscriptionWithDetails, bp as Tag, bq as TagsResponse, br as TaxPathComponent, bs as TaxonomyAttributeTemplate, bt as TaxonomyWithChildren, bu as UICart, bv as UICartBusiness, bw as UICartCustomer, bx as UICartLocation, by as UICartPricing, bz as UpdateCartItemInput, bA as VariantAxis, bB as VariantAxisSelection, bC as VariantAxisValue, bD as VariantAxisValueView, bE as VariantAxisView, bF as VariantAxisWithValues, bG as VariantDetails, bH as VariantDetailsDTO, bI as VariantDisplayAttribute, bJ as VariantLocationAvailability, bK as VariantStrategy, bL as VariantView, bM as ZERO, bN as currencyCode, bO as enrichError, bP as getErrorHint, bQ as isCimplifyError, bR as isIdempotencyMismatchError, bS as isQuoteConflictRequiringConsent, bT as isQuoteError, bU as isRetryableError, bV as isSupportedCurrency, bW as money, bX as moneyFromNumber } from './product-B_kS4Oxa.mjs';
4
4
  export { C as CURRENCY_SYMBOLS, M as MOBILE_MONEY_PROVIDERS, c as categorizePaymentError, d as detectMobileMoneyProvider, f as formatMoney, a as formatNumberCompact, b as formatPrice, e as formatPriceAdjustment, g as formatPriceCompact, h as formatPriceRange, i as formatPriceWithTax, j as formatProductPrice, k as getBasePrice, l as getCurrencySymbol, m as getDiscountPercentage, n as getDisplayPrice, o as getMarkupPercentage, p as getPriceRange, q as getProductCurrency, r as getTaxAmount, s as getUnitPriceAtQuantity, t as hasTaxInfo, u as isOnSale, v as isPaymentStatusFailure, w as isPaymentStatusRequiresAction, x as isPaymentStatusSuccess, y as isTaxInclusive, z as isValidPhoneForContext, A as normalizePaymentResponse, B as normalizePhoneToE164, D as normalizeStatusResponse, E as parsePrice, F as resolvePhoneCountryCode } from './index-D8vnKlOQ.mjs';
5
5
  export { A as AdConfig, a as AdContextValue, b as AdCreative, c as AdPosition, d as AdSlot, e as AdTheme, S as SignInOptions, g as getVariantDisplayName, s as startSignIn } from './sign-in-TL01-awQ.mjs';
6
6
  export { A as AddressAuthorizationData, a as AuthorizationType, I as InitializePaymentResult, P as Payment, b as PaymentErrorDetails, c as PaymentMethod, d as PaymentMethodType, e as PaymentProcessingState, f as PaymentProvider, g as PaymentResponse, h as PaymentStatus, i as PaymentStatusResponse, S as SubmitAuthorizationInput } from './payment-DVS7ZUEp.mjs';
@@ -8,6 +8,29 @@ export { F as FormatCompactOptions, a as FormatPriceOptions, P as ProductWithPri
8
8
  export { generateIdempotencyKey } from './advanced.mjs';
9
9
  import 'libphonenumber-js';
10
10
 
11
+ interface GalleryImage {
12
+ url: string;
13
+ /** null = product-level image; otherwise the variant it belongs to. */
14
+ variantId: string | null;
15
+ }
16
+ type GalleryProduct = Pick<ProductWithDetails, "image_url" | "images" | "variants">;
17
+ /**
18
+ * The gallery to show for a product, optionally scoped to a selected variant.
19
+ *
20
+ * Resolution order (replace-on-select):
21
+ * 1. Selected variant's own photos, if it has any.
22
+ * 2. Product-level gallery (`images`, which already includes `image_url`).
23
+ * 3. First variant with photos — covers the fashion case where the product
24
+ * row has no images and every photo lives on a variant.
25
+ * 4. The primary `image_url` alone.
26
+ */
27
+ declare function resolveGallery(product: GalleryProduct, selectedVariantId?: string): string[];
28
+ /**
29
+ * Every image across the product and all its variants, deduped by URL and
30
+ * tagged with provenance. Use for a "view all photos" lightbox.
31
+ */
32
+ declare function allGalleryImages(product: GalleryProduct): GalleryImage[];
33
+
11
34
  interface CustomerGroup {
12
35
  id: string;
13
36
  business_id: string;
@@ -95,4 +118,4 @@ interface AssetUrlOptions extends AssetTransform {
95
118
  declare function assetUrl(path: string, opts?: AssetUrlOptions): string;
96
119
  declare function isCimplifyAsset(src: string, base?: string): boolean;
97
120
 
98
- export { ApiError, type ApiResponse, type AssetTransform, type AssetUrlOptions, CIMPLIFY_CDN_HOSTS, type CustomerGroup, type CustomerPricingInfo, DEFAULT_CDN_BASE_URL, type FrontendContext, type MutationRequest, type PriceListItem, type QuantityBreak, type QueryRequest, type ResolvedQuantityBreak, type ResponseMetadata, type SilentSignInOptions, type SilentSignInResult, assetUrl, isCimplifyAsset, signInSilent };
121
+ export { ApiError, type ApiResponse, type AssetTransform, type AssetUrlOptions, CIMPLIFY_CDN_HOSTS, type CustomerGroup, type CustomerPricingInfo, DEFAULT_CDN_BASE_URL, type FrontendContext, type GalleryImage, type MutationRequest, type PriceListItem, ProductWithDetails, type QuantityBreak, type QueryRequest, type ResolvedQuantityBreak, type ResponseMetadata, type SilentSignInOptions, type SilentSignInResult, allGalleryImages, assetUrl, isCimplifyAsset, resolveGallery, signInSilent };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { A as AUTHORIZATION_TYPE, a as AUTH_MUTATION, b as AbortablePromise, c as ActivityRecommendation, d as ActivityRecommendationsResponse, e as ActivityService, f as ActivityStateResponse, g as AddressData, h as AddressInfo, i as AmountToPay, j as AuthResponse, k as AuthService, l as AuthStatus, m as AuthenticatedCustomer, n as AuthenticatedData, o as AutocompletePrediction, p as AutocompleteResponse, q as AvailabilityResult, r as AvailableSlot, B as Booking, s as BookingModificationType, t as BookingStatus, u as BookingWithDetails, v as BufferTimes, w as Business, x as BusinessHours, y as BusinessPreferences, z as BusinessService, C as BusinessSettings, D as BusinessType, E as BusinessWithLocations, F as CHECKOUT_MODE, G as CHECKOUT_MUTATION, H as CHECKOUT_STEP, I as CONTACT_TYPE, J as CacheOptions, K as CancelBookingInput, L as CancelBookingResult, M as CancelOrderInput, N as CancellationPolicy, O as CartOperations, P as CatalogueQueries, Q as CatalogueResult, R as CatalogueSnapshot, S as CategoryInfo, T as ChatAttachment, U as ChatConversation, V as ChatConversationResponse, W as ChatMessage, X as ChatWidgetStarter, Y as CheckSlotAvailabilityInput, Z as CheckSlotAvailabilityResult, _ as CheckoutAddressInfo, $ as CheckoutCartData, a0 as CheckoutCartItem, a1 as CheckoutCustomerInfo, a2 as CheckoutFormData, a3 as CheckoutInput, a4 as CheckoutMode, a8 as CheckoutOperations, a5 as CheckoutOrderType, a6 as CheckoutPaymentMethod, a7 as CheckoutResult, a8 as CheckoutService, a9 as CheckoutStatus, aa as CheckoutStatusContext, ab as CheckoutStep, ac as CimplifyClient, ad as CimplifyConfig, ae as CimplifyElement, af as CimplifyElements, ag as ContactType, ah as ContentType, ai as CreateAddressInput, aj as CreateMobileMoneyInput, ak as Customer, al as CustomerAddress, am as CustomerBooking, an as CustomerBookingServiceItem, ao as CustomerLinkPreferences, ap as CustomerMobileMoney, aq as CustomerServicePreferences, ar as DEFAULT_COUNTRY, as as DEFAULT_CURRENCY, at as DEVICE_TYPE, au as DayAvailability, av as DeliveryFeeDetails, aw as DeliveryFeeResponse, ax as DeliveryService, ay as DepositResult, az as DeviceType, aA as DismissMessageResponse, aB as ELEMENT_TYPES, aC as EVENT_TYPES, aD as ElementAppearance, aE as ElementEventHandler, aF as ElementEventType, aG as ElementOptions, aH as ElementType, aI as ElementsCheckoutData, aJ as ElementsCheckoutResult, aK as ElementsCustomerInfo, aL as ElementsOptions, aM as EnrollAndLinkOrderInput, aN as EnrollAndLinkOrderResult, aO as EnrollmentData, aP as Err, aQ as FeeBearerType, aR as FetchQuoteInput, aS as FulfillmentLink, aT as FulfillmentStatus, aU as FulfillmentType, aV as FxQuote, aW as FxQuoteRequest, aX as FxRateResponse, aY as FxService, aZ as GetAvailableSlotsInput, a_ as GetOrdersOptions, a$ as GetProductsOptions, b0 as IframeToParentMessage, b1 as InventoryService, b2 as LINK_MUTATION, b3 as LINK_QUERY, b4 as LineItem, b5 as LineType, b6 as LinkData, b7 as LinkEnrollResult, b8 as LinkService, b9 as LinkSession, ba as LinkStatusResult, bb as LiteBootstrap, bc as LiteService, bd as Location, be as LocationBooking, bf as LocationTaxBehavior, bg as LocationTaxOverrides, bh as LocationTimeProfile, bi as LocationWithDetails, bj as MESSAGE_TYPES, bk as MOBILE_MONEY_PROVIDER, bl as MobileMoneyData, bm as MobileMoneyDetails, bn as MobileMoneyProvider, bo as NextAction, bp as ORDER_MUTATION, bq as ORDER_TYPE, br as ObservabilityHooks, bs as Ok, bt as Order, bu as OrderChannel, bv as OrderFilter, bw as OrderFulfillmentSummary, bx as OrderGroup, by as OrderGroupDetails, bz as OrderGroupPayment, bA as OrderGroupPaymentState, bB as OrderGroupPaymentStatus, bC as OrderGroupPaymentSummary, bD as OrderGroupStatus, bE as OrderHistory, bF as OrderLineState, bG as OrderLineStatus, bH as OrderPaymentEvent, bI as OrderQueries, bJ as OrderSplitDetail, bK as OrderStatus, bL as OrderType, bM as OtpResult, bN as PAYMENT_METHOD, bO as PAYMENT_MUTATION, bP as PAYMENT_STATE, bQ as PICKUP_TIME_TYPE, bR as ParentToIframeMessage, bS as PaymentMethodInfo, bT as PaymentState, bU as PickupTime, bV as PickupTimeType, bW as PlaceDetailsResponse, bX as PlacesService, bY as PriceQuote, bZ as PricingOverrides, b_ as ProcessAndResolveOptions, b$ as ProcessCheckoutOptions, c0 as ProcessCheckoutResult, c1 as ProviderResolutionSource, c2 as QuoteBundleSelectionInput, c3 as QuoteCompositeSelectionInput, c4 as QuoteDynamicBuckets, c5 as QuoteStatus, c6 as QuoteUiMessage, c7 as ReadRequestOptions, c8 as RefreshQuoteInput, c9 as RefreshQuoteResult, ca as RefundOrderInput, cb as RelatedCandidate, cc as RelatedProduct, cd as RelatedProductsEnrichment, ce as RelationType, cf as ReminderMethod, cg as ReminderSettings, ch as ReorderResult, ci as RequestContext, cj as RequestErrorEvent, ck as RequestOptions, cl as RequestOtpInput, cm as RequestSource, cn as RequestStartEvent, co as RequestSuccessEvent, cp as RescheduleBookingInput, cq as RescheduleBookingResult, cr as RescheduleHistoryRecord, cs as ResourceAssignment, ct as Result, cu as RetryEvent, cv as RevokeAllSessionsResult, cw as RevokeSessionResult, cx as Room, cy as SchedulingMetadata, cz as SchedulingResult, cA as SchedulingService, cB as SenderType, cC as Service, cD as ServiceAvailabilityParams, cE as ServiceAvailabilityResult, cF as ServiceCharge, cG as ServiceNotes, cH as ServiceScheduleRequest, cI as ServiceStatus, cJ as SessionActivityData, cK as SessionChangeEvent, cL as SessionMessage, cM as SlotResourceInfo, cN as SlotStaffInfo, cO as Staff, cP as StaffAssignment, cQ as StaffRole, cR as StaffScheduleItem, cS as StockLevel, cT as StockStatus, cU as StorefrontBootstrap, cV as SubscriptionService, cW as SupportService, cX as Table, cY as TableInfo, cZ as TimeRange, c_ as TimeRanges, c$ as TimeSlot, d0 as TrackCategoryViewOptions, d1 as TrackProductViewOptions, d2 as UpdateAddressInput, d3 as UpdateOrderStatusInput, d4 as UpdateProfileInput, d5 as UploadInitResponse, d6 as UploadResult, d7 as UploadService, d8 as VerifyOtpInput, d9 as combine, da as combineObject, db as createCimplifyClient, dc as createElements, dd as err, de as flatMap, df as fromPromise, dg as getOrElse, dh as isErr, di as isOk, dj as mapError, dk as mapResult, dl as ok, dm as toNullable, dn as tryCatch, dp as unwrap } from './client-Dfg_hmkP.js';
2
- import { j as ApiError } from './product-B_kS4Oxa.js';
3
- export { A as AddOn, a as AddOnDetails, b as AddOnGroupDetails, c as AddOnOption, d as AddOnOptionDetails, e as AddOnOptionPrice, f as AddOnWithOptions, g as AddToCartInput, h as AddressValue, i as AdjustmentType, k as AppliedDiscount, l as AttributeAppliesTo, m as AttributeType, n as AttributeValidationRules, o as AttributeVisibility, B as BenefitType, p as BillingFrequency, q as BillingMarkupType, r as BillingPlanType, s as Bundle, t as BundleComponentData, u as BundleComponentInfo, v as BundleComponentVariantView, w as BundleComponentView, x as BundlePriceType, y as BundleProduct, z as BundleSelectionData, C as BundleSelectionInput, D as BundleStoredSelection, E as BundleSummary, F as BundleWithDetails, G as Cart, H as CartAddOn, I as CartChannel, J as CartItem, K as CartItemDetails, L as CartMutationResult, M as CartNotice, N as CartStatus, O as CartSummary, P as CartTotals, Q as Category, R as CategorySummary, S as ChosenPrice, T as CimplifyError, U as Collection, V as CollectionProduct, W as CollectionSummary, X as ComponentGroup, Y as ComponentGroupWithComponents, Z as ComponentPriceBreakdown, _ as ComponentSchedulingData, $ as ComponentSelectionInput, a0 as ComponentSourceType, a1 as Composite, a2 as CompositeComponent, a3 as CompositeComponentView, a4 as CompositeGroupView, a5 as CompositePriceBreakdown, a6 as CompositePriceResult, a7 as CompositePricingMode, a8 as CompositeSelectionData, $ as CompositeSelectionInput, a9 as CompositeStoredSelection, aa as CompositeWithDetails, ab as CurrencyCode, ac as CustomAttributeDefinition, ad as CustomAttributeValue, ae as CustomerInputValue, af as DURATION_UNIT, ag as DateRangeValue, ah as Deal, ai as DealBenefitType, aj as DepositType, ak as DigitalProductType, al as DiscountBreakdown, am as DiscountDetails, an as DiscountValidation, ao as DisplayAddOn, ap as DisplayAddOnOption, aq as DisplayCart, ar as DisplayCartItem, as as DisplayMode, at as DurationUnit, au as ERROR_HINTS, av as EligiblePlansQuery, aw as ErrorCode, ax as ErrorCodeType, ay as ErrorHint, az as FacetValue, aA as FormattedPlanOption, aB as GroupPricingBehavior, aC as INPUT_FIELD_TYPE, aD as IdempotencyMismatchError, aE as InputFieldType, aF as InputFieldValidation, aG as InventoryType, aH as KnowledgeArticle, aI as LineConfiguration, aJ as LocationProductPrice, aK as LocationValue, aL as MeasurementValue, aM as Money, aN as PRODUCT_TYPE, aO as Pagination, aP as PaginationParams, aQ as PhoneValue, aR as Price, aS as PriceAdjustment, aT as PriceDecisionPath, aU as PriceEntryType, aV as PricePathTaxInfo, aW as PriceSource, aX as Product, aY as ProductAddOn, aZ as ProductAvailability, a_ as ProductAvailabilityNow, a$ as ProductBillingPlan, b0 as ProductDealInfo, b1 as ProductInputField, b2 as ProductProperty, b3 as ProductRenderHint, b4 as ProductTaxonomy, b5 as ProductTimeProfile, b6 as ProductType, b7 as ProductVariant, b8 as ProductVariantValue, b9 as ProductWithDetails, ba as PropertyFacet, bb as PropertySource, bc as QuantityPricingTier, bd as RENDER_HINT, be as RelatedProductView, bf as SalesChannel, bg as SchedulingMode, bh as SelectedAddOnOption, bi as SemanticKind, bj as SignatureValue, bk as Subscription, bl as SubscriptionInvoice, bm as SubscriptionItem, bn as SubscriptionStatus, bo as SubscriptionWithDetails, bp as Tag, bq as TagsResponse, br as TaxPathComponent, bs as TaxonomyAttributeTemplate, bt as TaxonomyWithChildren, bu as UICart, bv as UICartBusiness, bw as UICartCustomer, bx as UICartLocation, by as UICartPricing, bz as UpdateCartItemInput, bA as VariantAxis, bB as VariantAxisSelection, bC as VariantAxisValue, bD as VariantAxisValueView, bE as VariantAxisView, bF as VariantAxisWithValues, bG as VariantDetails, bH as VariantDetailsDTO, bI as VariantDisplayAttribute, bJ as VariantLocationAvailability, bK as VariantStrategy, bL as VariantView, bM as ZERO, bN as currencyCode, bO as enrichError, bP as getErrorHint, bQ as isCimplifyError, bR as isIdempotencyMismatchError, bS as isQuoteConflictRequiringConsent, bT as isQuoteError, bU as isRetryableError, bV as isSupportedCurrency, bW as money, bX as moneyFromNumber } from './product-B_kS4Oxa.js';
2
+ import { b9 as ProductWithDetails, j as ApiError } from './product-B_kS4Oxa.js';
3
+ export { A as AddOn, a as AddOnDetails, b as AddOnGroupDetails, c as AddOnOption, d as AddOnOptionDetails, e as AddOnOptionPrice, f as AddOnWithOptions, g as AddToCartInput, h as AddressValue, i as AdjustmentType, k as AppliedDiscount, l as AttributeAppliesTo, m as AttributeType, n as AttributeValidationRules, o as AttributeVisibility, B as BenefitType, p as BillingFrequency, q as BillingMarkupType, r as BillingPlanType, s as Bundle, t as BundleComponentData, u as BundleComponentInfo, v as BundleComponentVariantView, w as BundleComponentView, x as BundlePriceType, y as BundleProduct, z as BundleSelectionData, C as BundleSelectionInput, D as BundleStoredSelection, E as BundleSummary, F as BundleWithDetails, G as Cart, H as CartAddOn, I as CartChannel, J as CartItem, K as CartItemDetails, L as CartMutationResult, M as CartNotice, N as CartStatus, O as CartSummary, P as CartTotals, Q as Category, R as CategorySummary, S as ChosenPrice, T as CimplifyError, U as Collection, V as CollectionProduct, W as CollectionSummary, X as ComponentGroup, Y as ComponentGroupWithComponents, Z as ComponentPriceBreakdown, _ as ComponentSchedulingData, $ as ComponentSelectionInput, a0 as ComponentSourceType, a1 as Composite, a2 as CompositeComponent, a3 as CompositeComponentView, a4 as CompositeGroupView, a5 as CompositePriceBreakdown, a6 as CompositePriceResult, a7 as CompositePricingMode, a8 as CompositeSelectionData, $ as CompositeSelectionInput, a9 as CompositeStoredSelection, aa as CompositeWithDetails, ab as CurrencyCode, ac as CustomAttributeDefinition, ad as CustomAttributeValue, ae as CustomerInputValue, af as DURATION_UNIT, ag as DateRangeValue, ah as Deal, ai as DealBenefitType, aj as DepositType, ak as DigitalProductType, al as DiscountBreakdown, am as DiscountDetails, an as DiscountValidation, ao as DisplayAddOn, ap as DisplayAddOnOption, aq as DisplayCart, ar as DisplayCartItem, as as DisplayMode, at as DurationUnit, au as ERROR_HINTS, av as EligiblePlansQuery, aw as ErrorCode, ax as ErrorCodeType, ay as ErrorHint, az as FacetValue, aA as FormattedPlanOption, aB as GroupPricingBehavior, aC as INPUT_FIELD_TYPE, aD as IdempotencyMismatchError, aE as InputFieldType, aF as InputFieldValidation, aG as InventoryType, aH as KnowledgeArticle, aI as LineConfiguration, aJ as LocationProductPrice, aK as LocationValue, aL as MeasurementValue, aM as Money, aN as PRODUCT_TYPE, aO as Pagination, aP as PaginationParams, aQ as PhoneValue, aR as Price, aS as PriceAdjustment, aT as PriceDecisionPath, aU as PriceEntryType, aV as PricePathTaxInfo, aW as PriceSource, aX as Product, aY as ProductAddOn, aZ as ProductAvailability, a_ as ProductAvailabilityNow, a$ as ProductBillingPlan, b0 as ProductDealInfo, b1 as ProductInputField, b2 as ProductProperty, b3 as ProductRenderHint, b4 as ProductTaxonomy, b5 as ProductTimeProfile, b6 as ProductType, b7 as ProductVariant, b8 as ProductVariantValue, ba as PropertyFacet, bb as PropertySource, bc as QuantityPricingTier, bd as RENDER_HINT, be as RelatedProductView, bf as SalesChannel, bg as SchedulingMode, bh as SelectedAddOnOption, bi as SemanticKind, bj as SignatureValue, bk as Subscription, bl as SubscriptionInvoice, bm as SubscriptionItem, bn as SubscriptionStatus, bo as SubscriptionWithDetails, bp as Tag, bq as TagsResponse, br as TaxPathComponent, bs as TaxonomyAttributeTemplate, bt as TaxonomyWithChildren, bu as UICart, bv as UICartBusiness, bw as UICartCustomer, bx as UICartLocation, by as UICartPricing, bz as UpdateCartItemInput, bA as VariantAxis, bB as VariantAxisSelection, bC as VariantAxisValue, bD as VariantAxisValueView, bE as VariantAxisView, bF as VariantAxisWithValues, bG as VariantDetails, bH as VariantDetailsDTO, bI as VariantDisplayAttribute, bJ as VariantLocationAvailability, bK as VariantStrategy, bL as VariantView, bM as ZERO, bN as currencyCode, bO as enrichError, bP as getErrorHint, bQ as isCimplifyError, bR as isIdempotencyMismatchError, bS as isQuoteConflictRequiringConsent, bT as isQuoteError, bU as isRetryableError, bV as isSupportedCurrency, bW as money, bX as moneyFromNumber } from './product-B_kS4Oxa.js';
4
4
  export { C as CURRENCY_SYMBOLS, M as MOBILE_MONEY_PROVIDERS, c as categorizePaymentError, d as detectMobileMoneyProvider, f as formatMoney, a as formatNumberCompact, b as formatPrice, e as formatPriceAdjustment, g as formatPriceCompact, h as formatPriceRange, i as formatPriceWithTax, j as formatProductPrice, k as getBasePrice, l as getCurrencySymbol, m as getDiscountPercentage, n as getDisplayPrice, o as getMarkupPercentage, p as getPriceRange, q as getProductCurrency, r as getTaxAmount, s as getUnitPriceAtQuantity, t as hasTaxInfo, u as isOnSale, v as isPaymentStatusFailure, w as isPaymentStatusRequiresAction, x as isPaymentStatusSuccess, y as isTaxInclusive, z as isValidPhoneForContext, A as normalizePaymentResponse, B as normalizePhoneToE164, D as normalizeStatusResponse, E as parsePrice, F as resolvePhoneCountryCode } from './index-DIIlPUOC.js';
5
5
  export { A as AdConfig, a as AdContextValue, b as AdCreative, c as AdPosition, d as AdSlot, e as AdTheme, S as SignInOptions, g as getVariantDisplayName, s as startSignIn } from './sign-in-TL01-awQ.js';
6
6
  export { A as AddressAuthorizationData, a as AuthorizationType, I as InitializePaymentResult, P as Payment, b as PaymentErrorDetails, c as PaymentMethod, d as PaymentMethodType, e as PaymentProcessingState, f as PaymentProvider, g as PaymentResponse, h as PaymentStatus, i as PaymentStatusResponse, S as SubmitAuthorizationInput } from './payment-sn-yGL7v.js';
@@ -8,6 +8,29 @@ export { F as FormatCompactOptions, a as FormatPriceOptions, P as ProductWithPri
8
8
  export { generateIdempotencyKey } from './advanced.js';
9
9
  import 'libphonenumber-js';
10
10
 
11
+ interface GalleryImage {
12
+ url: string;
13
+ /** null = product-level image; otherwise the variant it belongs to. */
14
+ variantId: string | null;
15
+ }
16
+ type GalleryProduct = Pick<ProductWithDetails, "image_url" | "images" | "variants">;
17
+ /**
18
+ * The gallery to show for a product, optionally scoped to a selected variant.
19
+ *
20
+ * Resolution order (replace-on-select):
21
+ * 1. Selected variant's own photos, if it has any.
22
+ * 2. Product-level gallery (`images`, which already includes `image_url`).
23
+ * 3. First variant with photos — covers the fashion case where the product
24
+ * row has no images and every photo lives on a variant.
25
+ * 4. The primary `image_url` alone.
26
+ */
27
+ declare function resolveGallery(product: GalleryProduct, selectedVariantId?: string): string[];
28
+ /**
29
+ * Every image across the product and all its variants, deduped by URL and
30
+ * tagged with provenance. Use for a "view all photos" lightbox.
31
+ */
32
+ declare function allGalleryImages(product: GalleryProduct): GalleryImage[];
33
+
11
34
  interface CustomerGroup {
12
35
  id: string;
13
36
  business_id: string;
@@ -95,4 +118,4 @@ interface AssetUrlOptions extends AssetTransform {
95
118
  declare function assetUrl(path: string, opts?: AssetUrlOptions): string;
96
119
  declare function isCimplifyAsset(src: string, base?: string): boolean;
97
120
 
98
- export { ApiError, type ApiResponse, type AssetTransform, type AssetUrlOptions, CIMPLIFY_CDN_HOSTS, type CustomerGroup, type CustomerPricingInfo, DEFAULT_CDN_BASE_URL, type FrontendContext, type MutationRequest, type PriceListItem, type QuantityBreak, type QueryRequest, type ResolvedQuantityBreak, type ResponseMetadata, type SilentSignInOptions, type SilentSignInResult, assetUrl, isCimplifyAsset, signInSilent };
121
+ export { ApiError, type ApiResponse, type AssetTransform, type AssetUrlOptions, CIMPLIFY_CDN_HOSTS, type CustomerGroup, type CustomerPricingInfo, DEFAULT_CDN_BASE_URL, type FrontendContext, type GalleryImage, type MutationRequest, type PriceListItem, ProductWithDetails, type QuantityBreak, type QueryRequest, type ResolvedQuantityBreak, type ResponseMetadata, type SilentSignInOptions, type SilentSignInResult, allGalleryImages, assetUrl, isCimplifyAsset, resolveGallery, signInSilent };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkJYPLT56O_js = require('./chunk-JYPLT56O.js');
3
+ var chunkVV3GTDIP_js = require('./chunk-VV3GTDIP.js');
4
4
  var chunkL5GKVQVJ_js = require('./chunk-L5GKVQVJ.js');
5
5
  var chunkMW7ICTVK_js = require('./chunk-MW7ICTVK.js');
6
6
  var chunkJGBDWEPJ_js = require('./chunk-JGBDWEPJ.js');
@@ -24,8 +24,8 @@ async function signInSilent(opts) {
24
24
  }
25
25
  const authUrl = (opts.authUrl ?? DEFAULT_AUTH_URL).replace(/\/$/, "");
26
26
  const callbackUri = opts.callbackUri ?? "/auth/callback";
27
- const pkce = await chunkJYPLT56O_js.generatePkce();
28
- const state = chunkJYPLT56O_js.generateState();
27
+ const pkce = await chunkVV3GTDIP_js.generatePkce();
28
+ const state = chunkVV3GTDIP_js.generateState();
29
29
  const params = new URLSearchParams({
30
30
  response_type: "code",
31
31
  response_mode: "web_message",
@@ -95,43 +95,51 @@ async function signInSilent(opts) {
95
95
 
96
96
  Object.defineProperty(exports, "CIMPLIFY_CDN_HOSTS", {
97
97
  enumerable: true,
98
- get: function () { return chunkJYPLT56O_js.CIMPLIFY_CDN_HOSTS; }
98
+ get: function () { return chunkVV3GTDIP_js.CIMPLIFY_CDN_HOSTS; }
99
99
  });
100
100
  Object.defineProperty(exports, "DEFAULT_CDN_BASE_URL", {
101
101
  enumerable: true,
102
- get: function () { return chunkJYPLT56O_js.DEFAULT_CDN_BASE_URL; }
102
+ get: function () { return chunkVV3GTDIP_js.DEFAULT_CDN_BASE_URL; }
103
103
  });
104
104
  Object.defineProperty(exports, "DURATION_UNIT", {
105
105
  enumerable: true,
106
- get: function () { return chunkJYPLT56O_js.DURATION_UNIT; }
106
+ get: function () { return chunkVV3GTDIP_js.DURATION_UNIT; }
107
107
  });
108
108
  Object.defineProperty(exports, "INPUT_FIELD_TYPE", {
109
109
  enumerable: true,
110
- get: function () { return chunkJYPLT56O_js.INPUT_FIELD_TYPE; }
110
+ get: function () { return chunkVV3GTDIP_js.INPUT_FIELD_TYPE; }
111
111
  });
112
112
  Object.defineProperty(exports, "PRODUCT_TYPE", {
113
113
  enumerable: true,
114
- get: function () { return chunkJYPLT56O_js.PRODUCT_TYPE; }
114
+ get: function () { return chunkVV3GTDIP_js.PRODUCT_TYPE; }
115
115
  });
116
116
  Object.defineProperty(exports, "RENDER_HINT", {
117
117
  enumerable: true,
118
- get: function () { return chunkJYPLT56O_js.RENDER_HINT; }
118
+ get: function () { return chunkVV3GTDIP_js.RENDER_HINT; }
119
+ });
120
+ Object.defineProperty(exports, "allGalleryImages", {
121
+ enumerable: true,
122
+ get: function () { return chunkVV3GTDIP_js.allGalleryImages; }
119
123
  });
120
124
  Object.defineProperty(exports, "assetUrl", {
121
125
  enumerable: true,
122
- get: function () { return chunkJYPLT56O_js.assetUrl; }
126
+ get: function () { return chunkVV3GTDIP_js.assetUrl; }
123
127
  });
124
128
  Object.defineProperty(exports, "getVariantDisplayName", {
125
129
  enumerable: true,
126
- get: function () { return chunkJYPLT56O_js.getVariantDisplayName; }
130
+ get: function () { return chunkVV3GTDIP_js.getVariantDisplayName; }
127
131
  });
128
132
  Object.defineProperty(exports, "isCimplifyAsset", {
129
133
  enumerable: true,
130
- get: function () { return chunkJYPLT56O_js.isCimplifyAsset; }
134
+ get: function () { return chunkVV3GTDIP_js.isCimplifyAsset; }
135
+ });
136
+ Object.defineProperty(exports, "resolveGallery", {
137
+ enumerable: true,
138
+ get: function () { return chunkVV3GTDIP_js.resolveGallery; }
131
139
  });
132
140
  Object.defineProperty(exports, "startSignIn", {
133
141
  enumerable: true,
134
- get: function () { return chunkJYPLT56O_js.startSignIn; }
142
+ get: function () { return chunkVV3GTDIP_js.startSignIn; }
135
143
  });
136
144
  Object.defineProperty(exports, "isValidPhoneForContext", {
137
145
  enumerable: true,
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { generatePkce, generateState } from './chunk-XYI4NXWG.mjs';
2
- export { CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, assetUrl, getVariantDisplayName, isCimplifyAsset, startSignIn } from './chunk-XYI4NXWG.mjs';
1
+ import { generatePkce, generateState } from './chunk-W6FRIYYU.mjs';
2
+ export { CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, allGalleryImages, assetUrl, getVariantDisplayName, isCimplifyAsset, resolveGallery, startSignIn } from './chunk-W6FRIYYU.mjs';
3
3
  export { isValidPhoneForContext, normalizePhoneToE164, resolvePhoneCountryCode } from './chunk-YOIVZ6OA.mjs';
4
4
  export { ActivityService, CimplifyClient, DeliveryService, PlacesService, SubscriptionService, SupportService, UploadService, createCimplifyClient } from './chunk-SQ7U3BWY.mjs';
5
5
  export { AUTHORIZATION_TYPE, AUTH_MUTATION, AuthService, BusinessService, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CONTACT_TYPE, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, DEFAULT_COUNTRY, DEFAULT_CURRENCY, DEVICE_TYPE, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LINK_MUTATION, LINK_QUERY, LinkService, LiteService, MESSAGE_TYPES, MOBILE_MONEY_PROVIDER, ORDER_MUTATION, ORDER_TYPE, OrderQueries, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, SchedulingService, combine, combineObject, createElements, err, flatMap, fromPromise, generateIdempotencyKey, getOrElse, isErr, isOk, mapError, mapResult, ok, toNullable, tryCatch, unwrap } from './chunk-I4IXPQIX.mjs';
package/dist/react.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkJYPLT56O_js = require('./chunk-JYPLT56O.js');
4
+ var chunkVV3GTDIP_js = require('./chunk-VV3GTDIP.js');
5
5
  var chunkMW7ICTVK_js = require('./chunk-MW7ICTVK.js');
6
6
  var chunkJGBDWEPJ_js = require('./chunk-JGBDWEPJ.js');
7
7
  var chunk7Y2O3E4D_js = require('./chunk-7Y2O3E4D.js');
@@ -2714,7 +2714,7 @@ function CimplifySignInButton({
2714
2714
  const onClick = async () => {
2715
2715
  if (busy || disabled) return;
2716
2716
  setBusy(true);
2717
- await chunkJYPLT56O_js.startSignIn({
2717
+ await chunkVV3GTDIP_js.startSignIn({
2718
2718
  ...signInOpts,
2719
2719
  onSuccess: () => {
2720
2720
  setBusy(false);
@@ -5463,7 +5463,7 @@ function VariantSelector({
5463
5463
  {
5464
5464
  "data-cimplify-variant-name": true,
5465
5465
  className: cn("flex-1 min-w-0 text-sm", classNames?.name),
5466
- children: chunkJYPLT56O_js.getVariantDisplayName(variant, productName)
5466
+ children: chunkVV3GTDIP_js.getVariantDisplayName(variant, productName)
5467
5467
  }
5468
5468
  ),
5469
5469
  /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, className: cn("text-sm text-muted-foreground", classNames?.pricing), children: [
@@ -6936,12 +6936,12 @@ function FieldInput({
6936
6936
  classNames?.input
6937
6937
  );
6938
6938
  switch (field.field_type) {
6939
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Text:
6940
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Url:
6939
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Text:
6940
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Url:
6941
6941
  return /* @__PURE__ */ jsxRuntime.jsx(
6942
6942
  "input",
6943
6943
  {
6944
- type: field.field_type === chunkJYPLT56O_js.INPUT_FIELD_TYPE.Url ? "url" : "text",
6944
+ type: field.field_type === chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Url ? "url" : "text",
6945
6945
  value: typeof value === "string" ? value : "",
6946
6946
  onChange: (e) => onValueChange(e.target.value),
6947
6947
  placeholder: field.placeholder,
@@ -6950,7 +6950,7 @@ function FieldInput({
6950
6950
  className: inputClass
6951
6951
  }
6952
6952
  );
6953
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Textarea:
6953
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Textarea:
6954
6954
  return /* @__PURE__ */ jsxRuntime.jsx(
6955
6955
  "textarea",
6956
6956
  {
@@ -6963,7 +6963,7 @@ function FieldInput({
6963
6963
  className: cn(inputClass, "resize-none", classNames?.textarea)
6964
6964
  }
6965
6965
  );
6966
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Number:
6966
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Number:
6967
6967
  return /* @__PURE__ */ jsxRuntime.jsx(
6968
6968
  "input",
6969
6969
  {
@@ -6977,7 +6977,7 @@ function FieldInput({
6977
6977
  className: inputClass
6978
6978
  }
6979
6979
  );
6980
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Select:
6980
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Select:
6981
6981
  return /* @__PURE__ */ jsxRuntime.jsxs(
6982
6982
  "select",
6983
6983
  {
@@ -6991,7 +6991,7 @@ function FieldInput({
6991
6991
  ]
6992
6992
  }
6993
6993
  );
6994
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Radio:
6994
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Radio:
6995
6995
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-2", classNames?.radioGroup), children: (field.options || []).map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
6996
6996
  "label",
6997
6997
  {
@@ -7016,7 +7016,7 @@ function FieldInput({
7016
7016
  },
7017
7017
  opt
7018
7018
  )) });
7019
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Checkbox:
7019
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Checkbox:
7020
7020
  return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: cn("flex items-center gap-2 text-sm cursor-pointer", classNames?.checkboxLabel), children: [
7021
7021
  /* @__PURE__ */ jsxRuntime.jsx(
7022
7022
  "input",
@@ -7029,7 +7029,7 @@ function FieldInput({
7029
7029
  ),
7030
7030
  field.placeholder || field.name
7031
7031
  ] });
7032
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Color:
7032
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Color:
7033
7033
  return /* @__PURE__ */ jsxRuntime.jsx(
7034
7034
  "input",
7035
7035
  {
@@ -7039,7 +7039,7 @@ function FieldInput({
7039
7039
  className: cn("w-12 h-10 rounded-md border border-input cursor-pointer", classNames?.colorInput)
7040
7040
  }
7041
7041
  );
7042
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Date:
7042
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Date:
7043
7043
  return /* @__PURE__ */ jsxRuntime.jsx(
7044
7044
  DatePicker,
7045
7045
  {
@@ -7050,8 +7050,8 @@ function FieldInput({
7050
7050
  "aria-label": field.name
7051
7051
  }
7052
7052
  );
7053
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.File:
7054
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Image:
7053
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.File:
7054
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Image:
7055
7055
  return /* @__PURE__ */ jsxRuntime.jsx(
7056
7056
  FileUploadInput,
7057
7057
  {
@@ -7062,7 +7062,7 @@ function FieldInput({
7062
7062
  classNames
7063
7063
  }
7064
7064
  );
7065
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Email:
7065
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Email:
7066
7066
  return /* @__PURE__ */ jsxRuntime.jsx(
7067
7067
  "input",
7068
7068
  {
@@ -7074,7 +7074,7 @@ function FieldInput({
7074
7074
  className: inputClass
7075
7075
  }
7076
7076
  );
7077
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.DateTime: {
7077
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.DateTime: {
7078
7078
  const stringValue = typeof value === "string" ? value : "";
7079
7079
  const [datePart, timePartRaw] = stringValue.includes("T") ? stringValue.split("T", 2) : [stringValue, ""];
7080
7080
  const timePart = (timePartRaw ?? "").slice(0, 5);
@@ -7113,7 +7113,7 @@ function FieldInput({
7113
7113
  )
7114
7114
  ] });
7115
7115
  }
7116
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Time:
7116
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Time:
7117
7117
  return /* @__PURE__ */ jsxRuntime.jsx(
7118
7118
  TimePicker,
7119
7119
  {
@@ -7124,7 +7124,7 @@ function FieldInput({
7124
7124
  "aria-label": field.name
7125
7125
  }
7126
7126
  );
7127
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.MultiSelect:
7127
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.MultiSelect:
7128
7128
  return /* @__PURE__ */ jsxRuntime.jsx(
7129
7129
  MultiSelectInput,
7130
7130
  {
@@ -7134,7 +7134,7 @@ function FieldInput({
7134
7134
  classNames
7135
7135
  }
7136
7136
  );
7137
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.DateRange:
7137
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.DateRange:
7138
7138
  return /* @__PURE__ */ jsxRuntime.jsx(
7139
7139
  DateRangeInput,
7140
7140
  {
@@ -7144,7 +7144,7 @@ function FieldInput({
7144
7144
  classNames
7145
7145
  }
7146
7146
  );
7147
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Address:
7147
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Address:
7148
7148
  return /* @__PURE__ */ jsxRuntime.jsx(
7149
7149
  AddressInput,
7150
7150
  {
@@ -7155,7 +7155,7 @@ function FieldInput({
7155
7155
  inputClass
7156
7156
  }
7157
7157
  );
7158
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Location:
7158
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Location:
7159
7159
  return /* @__PURE__ */ jsxRuntime.jsx(
7160
7160
  LocationInput,
7161
7161
  {
@@ -7166,7 +7166,7 @@ function FieldInput({
7166
7166
  inputClass
7167
7167
  }
7168
7168
  );
7169
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Phone:
7169
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Phone:
7170
7170
  return /* @__PURE__ */ jsxRuntime.jsx(
7171
7171
  PhoneInput,
7172
7172
  {
@@ -7177,7 +7177,7 @@ function FieldInput({
7177
7177
  inputClass
7178
7178
  }
7179
7179
  );
7180
- case chunkJYPLT56O_js.INPUT_FIELD_TYPE.Signature:
7180
+ case chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Signature:
7181
7181
  return /* @__PURE__ */ jsxRuntime.jsx(
7182
7182
  SignatureInput,
7183
7183
  {
@@ -7210,7 +7210,7 @@ function FileUploadInput({
7210
7210
  const [isUploading, setIsUploading] = React12__default.default.useState(false);
7211
7211
  const fileUrl = typeof value === "string" ? value : void 0;
7212
7212
  const acceptedFormats = field.validation?.accepted_formats;
7213
- const accept = acceptedFormats ? acceptedFormats.map((f) => `.${f}`).join(",") : field.field_type === chunkJYPLT56O_js.INPUT_FIELD_TYPE.Image ? "image/*" : void 0;
7213
+ const accept = acceptedFormats ? acceptedFormats.map((f) => `.${f}`).join(",") : field.field_type === chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Image ? "image/*" : void 0;
7214
7214
  const handleFile = async (file) => {
7215
7215
  if (!onFileUpload) return;
7216
7216
  if (field.validation?.max_size_mb) {
@@ -7228,7 +7228,7 @@ function FileUploadInput({
7228
7228
  }
7229
7229
  };
7230
7230
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-2", classNames?.fileInput), children: fileUrl ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
7231
- field.field_type === chunkJYPLT56O_js.INPUT_FIELD_TYPE.Image && /* @__PURE__ */ jsxRuntime.jsx("img", { src: fileUrl, alt: "Uploaded", className: "w-16 h-16 object-cover rounded-md border border-border" }),
7231
+ field.field_type === chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Image && /* @__PURE__ */ jsxRuntime.jsx("img", { src: fileUrl, alt: "Uploaded", className: "w-16 h-16 object-cover rounded-md border border-border" }),
7232
7232
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground truncate", children: fileUrl.split("/").pop() }) }),
7233
7233
  /* @__PURE__ */ jsxRuntime.jsx(
7234
7234
  "button",
@@ -7254,7 +7254,7 @@ function FileUploadInput({
7254
7254
  }
7255
7255
  ),
7256
7256
  isUploading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Uploading..." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7257
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: field.placeholder || `Upload ${field.field_type === chunkJYPLT56O_js.INPUT_FIELD_TYPE.Image ? "image" : "file"}` }),
7257
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: field.placeholder || `Upload ${field.field_type === chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Image ? "image" : "file"}` }),
7258
7258
  acceptedFormats && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground/60 mt-1", children: [
7259
7259
  acceptedFormats.map((f) => f.toUpperCase()).join(", "),
7260
7260
  field.validation?.max_size_mb && ` \xB7 Max ${field.validation.max_size_mb}MB`
@@ -8876,7 +8876,7 @@ function CartLineItemRow({
8876
8876
  const isOptimistic = item.isOptimistic === true;
8877
8877
  const lineTotal = chunk7Y2O3E4D_js.parsePrice(unitPrice) * item.quantity;
8878
8878
  const imageUrl = item.product.image_url;
8879
- const variantLabel = item.variant ? chunkJYPLT56O_js.getVariantDisplayName(item.variant, item.product.name) : null;
8879
+ const variantLabel = item.variant ? chunkVV3GTDIP_js.getVariantDisplayName(item.variant, item.product.name) : null;
8880
8880
  return /* @__PURE__ */ jsxRuntime.jsxs(
8881
8881
  "div",
8882
8882
  {
@@ -8976,7 +8976,7 @@ function CartLineItemRow({
8976
8976
  input.field_name,
8977
8977
  ":"
8978
8978
  ] }),
8979
- /* @__PURE__ */ jsxRuntime.jsx("dd", { "data-cimplify-cart-input-value": true, className: "text-foreground m-0 truncate", children: input.field_type === chunkJYPLT56O_js.INPUT_FIELD_TYPE.File || input.field_type === chunkJYPLT56O_js.INPUT_FIELD_TYPE.Image ? String(input.value).split("/").pop() || "Uploaded file" : String(input.value) })
8979
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { "data-cimplify-cart-input-value": true, className: "text-foreground m-0 truncate", children: input.field_type === chunkVV3GTDIP_js.INPUT_FIELD_TYPE.File || input.field_type === chunkVV3GTDIP_js.INPUT_FIELD_TYPE.Image ? String(input.value).split("/").pop() || "Uploaded file" : String(input.value) })
8980
8980
  ] }, input.field_id)) }),
8981
8981
  (item.lineType === "service" || item.product.type === "service") && item.scheduledStart && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-info": true, className: cn("mt-1.5 flex items-center gap-1.5 text-xs text-muted-foreground", classNames?.serviceInfo), children: [
8982
8982
  /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5 shrink-0", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
@@ -9532,7 +9532,7 @@ function FoodProductCard({
9532
9532
  const tags = product.tags || [];
9533
9533
  const isSignature = product.metadata?.is_signature === true;
9534
9534
  const isNew = product.metadata?.is_new === true;
9535
- const isComposite = product.type === chunkJYPLT56O_js.PRODUCT_TYPE.Composite;
9535
+ const isComposite = product.type === chunkVV3GTDIP_js.PRODUCT_TYPE.Composite;
9536
9536
  return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
9537
9537
  /* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
9538
9538
  isSignature && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "absolute top-3 left-3 inline-flex items-center gap-1 text-[11px] font-semibold tracking-wide bg-amber-50 text-amber-700 border border-amber-200/60 px-2 py-0.5 rounded-md", children: [
@@ -10285,26 +10285,26 @@ var BUILT_IN_CARDS = {
10285
10285
  ["composite" /* Composite */]: CompositeProductCard,
10286
10286
  ["subscription" /* Subscription */]: SubscriptionCard
10287
10287
  };
10288
- var RENTAL_UNITS = /* @__PURE__ */ new Set([chunkJYPLT56O_js.DURATION_UNIT.Days, chunkJYPLT56O_js.DURATION_UNIT.Hours]);
10289
- var LEASE_UNITS = /* @__PURE__ */ new Set([chunkJYPLT56O_js.DURATION_UNIT.Weeks, chunkJYPLT56O_js.DURATION_UNIT.Months, chunkJYPLT56O_js.DURATION_UNIT.Years]);
10288
+ var RENTAL_UNITS = /* @__PURE__ */ new Set([chunkVV3GTDIP_js.DURATION_UNIT.Days, chunkVV3GTDIP_js.DURATION_UNIT.Hours]);
10289
+ var LEASE_UNITS = /* @__PURE__ */ new Set([chunkVV3GTDIP_js.DURATION_UNIT.Weeks, chunkVV3GTDIP_js.DURATION_UNIT.Months, chunkVV3GTDIP_js.DURATION_UNIT.Years]);
10290
10290
  function resolveCardVariant(product) {
10291
- if (product.type === chunkJYPLT56O_js.PRODUCT_TYPE.Bundle) {
10291
+ if (product.type === chunkVV3GTDIP_js.PRODUCT_TYPE.Bundle) {
10292
10292
  return "bundle" /* Bundle */;
10293
10293
  }
10294
- if (product.type === chunkJYPLT56O_js.PRODUCT_TYPE.Composite) {
10294
+ if (product.type === chunkVV3GTDIP_js.PRODUCT_TYPE.Composite) {
10295
10295
  return "composite" /* Composite */;
10296
10296
  }
10297
10297
  if (product.quantity_pricing && product.quantity_pricing.length > 1) {
10298
10298
  return "wholesale" /* Wholesale */;
10299
10299
  }
10300
- if (product.type === chunkJYPLT56O_js.PRODUCT_TYPE.Digital) {
10300
+ if (product.type === chunkVV3GTDIP_js.PRODUCT_TYPE.Digital) {
10301
10301
  return "digital" /* Digital */;
10302
10302
  }
10303
- if (product.type === chunkJYPLT56O_js.PRODUCT_TYPE.Service) {
10303
+ if (product.type === chunkVV3GTDIP_js.PRODUCT_TYPE.Service) {
10304
10304
  if (product.duration_unit && RENTAL_UNITS.has(product.duration_unit)) {
10305
10305
  return "rental" /* Rental */;
10306
10306
  }
10307
- if (product.duration_unit === chunkJYPLT56O_js.DURATION_UNIT.Nights) {
10307
+ if (product.duration_unit === chunkVV3GTDIP_js.DURATION_UNIT.Nights) {
10308
10308
  return "accommodation" /* Accommodation */;
10309
10309
  }
10310
10310
  if (product.duration_unit && LEASE_UNITS.has(product.duration_unit)) {
@@ -10315,10 +10315,10 @@ function resolveCardVariant(product) {
10315
10315
  }
10316
10316
  return "standard" /* Standard */;
10317
10317
  }
10318
- if (product.render_hint === chunkJYPLT56O_js.RENDER_HINT.Food) {
10318
+ if (product.render_hint === chunkVV3GTDIP_js.RENDER_HINT.Food) {
10319
10319
  return "food" /* Food */;
10320
10320
  }
10321
- if (product.render_hint === chunkJYPLT56O_js.RENDER_HINT.Physical) {
10321
+ if (product.render_hint === chunkVV3GTDIP_js.RENDER_HINT.Physical) {
10322
10322
  return "retail" /* Retail */;
10323
10323
  }
10324
10324
  return "retail" /* Retail */;
@@ -12623,7 +12623,8 @@ function DefaultProductLayout({
12623
12623
  showRelated = true,
12624
12624
  className
12625
12625
  }) {
12626
- const images = product.images || (product.image_url ? [product.image_url] : []);
12626
+ const [selectedVariantId, setSelectedVariantId] = React12__default.default.useState();
12627
+ const images = chunkVV3GTDIP_js.resolveGallery(product, selectedVariantId);
12627
12628
  const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
12628
12629
  const onSale = chunk7Y2O3E4D_js.isOnSale(product);
12629
12630
  const hasPhysicalDetails = product.sku || product.vendor || product.material;
@@ -12688,7 +12689,8 @@ function DefaultProductLayout({
12688
12689
  ProductCustomizer,
12689
12690
  {
12690
12691
  product,
12691
- onAddToCart
12692
+ onAddToCart,
12693
+ onVariantChange: (variantId) => setSelectedVariantId(variantId)
12692
12694
  }
12693
12695
  )
12694
12696
  ] })
@@ -13258,25 +13260,25 @@ function resolveTemplateKey(product) {
13258
13260
  if (typeof metaTemplate === "string" && metaTemplate.trim()) {
13259
13261
  return metaTemplate.trim();
13260
13262
  }
13261
- if (product.type === chunkJYPLT56O_js.PRODUCT_TYPE.Bundle) {
13263
+ if (product.type === chunkVV3GTDIP_js.PRODUCT_TYPE.Bundle) {
13262
13264
  return "bundle" /* Bundle */;
13263
13265
  }
13264
- if (product.type === chunkJYPLT56O_js.PRODUCT_TYPE.Composite) {
13266
+ if (product.type === chunkVV3GTDIP_js.PRODUCT_TYPE.Composite) {
13265
13267
  return "composite" /* Composite */;
13266
13268
  }
13267
13269
  if (product.quantity_pricing && product.quantity_pricing.length > 1) {
13268
13270
  return "wholesale" /* Wholesale */;
13269
13271
  }
13270
- if (product.type === chunkJYPLT56O_js.PRODUCT_TYPE.Service) {
13272
+ if (product.type === chunkVV3GTDIP_js.PRODUCT_TYPE.Service) {
13271
13273
  return "service" /* Service */;
13272
13274
  }
13273
- if (product.type === chunkJYPLT56O_js.PRODUCT_TYPE.Digital) {
13275
+ if (product.type === chunkVV3GTDIP_js.PRODUCT_TYPE.Digital) {
13274
13276
  return "digital" /* Digital */;
13275
13277
  }
13276
- if (product.render_hint === chunkJYPLT56O_js.RENDER_HINT.Food) {
13278
+ if (product.render_hint === chunkVV3GTDIP_js.RENDER_HINT.Food) {
13277
13279
  return "food" /* Food */;
13278
13280
  }
13279
- if (product.render_hint === chunkJYPLT56O_js.RENDER_HINT.Physical) {
13281
+ if (product.render_hint === chunkVV3GTDIP_js.RENDER_HINT.Physical) {
13280
13282
  return "physical" /* Physical */;
13281
13283
  }
13282
13284
  return "default" /* Default */;
@@ -15502,7 +15504,7 @@ function SparkleIcon({ className }) {
15502
15504
 
15503
15505
  Object.defineProperty(exports, "getVariantDisplayName", {
15504
15506
  enumerable: true,
15505
- get: function () { return chunkJYPLT56O_js.getVariantDisplayName; }
15507
+ get: function () { return chunkVV3GTDIP_js.getVariantDisplayName; }
15506
15508
  });
15507
15509
  exports.AccommodationCard = AccommodationCard;
15508
15510
  exports.AccountContent = AccountContent;
package/dist/react.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, startSignIn, RENDER_HINT } from './chunk-XYI4NXWG.mjs';
3
- export { getVariantDisplayName } from './chunk-XYI4NXWG.mjs';
2
+ import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, resolveGallery, startSignIn, RENDER_HINT } from './chunk-W6FRIYYU.mjs';
3
+ export { getVariantDisplayName } from './chunk-W6FRIYYU.mjs';
4
4
  import { createCimplifyClient } from './chunk-SQ7U3BWY.mjs';
5
5
  import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-I4IXPQIX.mjs';
6
6
  import { formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-TD3AY34U.mjs';
@@ -12618,7 +12618,8 @@ function DefaultProductLayout({
12618
12618
  showRelated = true,
12619
12619
  className
12620
12620
  }) {
12621
- const images = product.images || (product.image_url ? [product.image_url] : []);
12621
+ const [selectedVariantId, setSelectedVariantId] = React12.useState();
12622
+ const images = resolveGallery(product, selectedVariantId);
12622
12623
  const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
12623
12624
  const onSale = isOnSale(product);
12624
12625
  const hasPhysicalDetails = product.sku || product.vendor || product.material;
@@ -12683,7 +12684,8 @@ function DefaultProductLayout({
12683
12684
  ProductCustomizer,
12684
12685
  {
12685
12686
  product,
12686
- onAddToCart
12687
+ onAddToCart,
12688
+ onVariantChange: (variantId) => setSelectedVariantId(variantId)
12687
12689
  }
12688
12690
  )
12689
12691
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.57.0",
3
+ "version": "0.58.0",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",
@@ -15,7 +15,7 @@
15
15
  "files": [
16
16
  {
17
17
  "path": "layouts/default-product-layout.tsx",
18
- "content": "\"use client\";\n\nimport React from \"react\";\nimport type { ProductLayoutProps } from \"@cimplify/sdk/react\";\nimport {\n TwoColumnGrid,\n RelatedProductsSection,\n CustomAttributesTable,\n PropertiesTable,\n TagPills,\n InventoryBadge,\n} from \"@cimplify/sdk/react\";\nimport { ProductImageGallery } from \"@cimplify/sdk/react\";\nimport { ProductCustomizer } from \"@cimplify/sdk/react\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { PriceRange } from \"@cimplify/sdk/react\";\nimport { AvailabilityBadge } from \"@cimplify/sdk/react\";\nimport { SaleBadge } from \"@cimplify/sdk/react\";\nimport { parsePrice, isOnSale, getBasePrice, getDiscountPercentage } from \"@cimplify/sdk\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport function DefaultProductLayout({\n product,\n onAddToCart,\n renderBreadcrumb,\n relatedProducts,\n showRelated = true,\n className,\n}: ProductLayoutProps): React.ReactElement {\n const images = product.images || (product.image_url ? [product.image_url] : []);\n const hasRange = (product.quantity_pricing && product.quantity_pricing.length > 1)\n || (product.variants && product.variants.length > 1);\n const onSale = isOnSale(product);\n const hasPhysicalDetails = product.sku || product.vendor || product.material;\n\n return (\n <div data-cimplify-product-layout=\"default\" className={cn(\"space-y-8\", className)}>\n {renderBreadcrumb?.(product)}\n\n <TwoColumnGrid\n left={\n <ProductImageGallery\n images={images}\n productName={product.name}\n />\n }\n right={\n <div className=\"space-y-6\">\n {/* Brand + Tags */}\n <div className=\"flex flex-wrap items-center gap-2\">\n {product.vendor && (\n <span className=\"text-xs font-semibold text-muted-foreground uppercase tracking-widest\">\n {product.vendor}\n </span>\n )}\n <TagPills tags={product.tags || []} />\n </div>\n\n {/* Name */}\n <h1 data-cimplify-product-layout-name className=\"text-3xl lg:text-4xl font-extrabold tracking-tight\">\n {product.name}\n </h1>\n\n {/* Price */}\n <div className=\"flex items-baseline gap-3\">\n {hasRange ? (\n <PriceRange product={product} className=\"text-2xl font-extrabold\" />\n ) : onSale ? (\n <>\n <Price amount={product.default_price} className=\"text-2xl font-extrabold\" />\n <Price amount={getBasePrice(product)} className=\"text-lg text-muted-foreground line-through\" />\n <span className=\"text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5\">\n Save {getDiscountPercentage(product)}%\n </span>\n </>\n ) : (\n <Price amount={product.default_price} className=\"text-2xl font-semibold\" />\n )}\n </div>\n\n {/* Inventory */}\n <InventoryBadge product={product} />\n\n {/* Description */}\n {product.description && (\n <p data-cimplify-product-layout-description className=\"text-muted-foreground leading-relaxed\">\n {product.description}\n </p>\n )}\n\n {/* Physical product details */}\n {hasPhysicalDetails && (\n <div data-cimplify-product-layout-details className=\"space-y-1 text-sm text-muted-foreground\">\n {product.sku && <p>SKU: <span className=\"font-mono text-foreground\">{product.sku}</span></p>}\n {product.barcode && <p>Barcode: <span className=\"font-mono text-foreground\">{product.barcode}</span></p>}\n {product.material && <p>Material: <span className=\"text-foreground\">{product.material}</span></p>}\n {product.vendor && <p>Brand: <span className=\"text-foreground\">{product.vendor}</span></p>}\n {(product.length_mm || product.width_mm || product.height_mm) && (\n <p>Dimensions: <span className=\"text-foreground\">\n {[product.length_mm, product.width_mm, product.height_mm]\n .filter(Boolean)\n .map((d) => `${(d! / 10).toFixed(1)} cm`)\n .join(\" x \")}\n </span></p>\n )}\n {product.item_condition && product.item_condition !== \"new\" && (\n <p>Condition: <span className=\"text-foreground capitalize\">{product.item_condition}</span></p>\n )}\n </div>\n )}\n\n {/* Custom Attributes */}\n <CustomAttributesTable attributes={product.custom_attributes || []} />\n\n {/* Properties */}\n <PropertiesTable properties={product.properties || []} />\n\n {/* Customizer */}\n <ProductCustomizer\n product={product}\n onAddToCart={onAddToCart}\n />\n </div>\n }\n />\n\n {showRelated && relatedProducts && relatedProducts.length > 0 && (\n <RelatedProductsSection\n products={relatedProducts}\n />\n )}\n </div>\n );\n}\n"
18
+ "content": "\"use client\";\n\nimport React from \"react\";\nimport type { ProductLayoutProps } from \"@cimplify/sdk/react\";\nimport {\n TwoColumnGrid,\n RelatedProductsSection,\n CustomAttributesTable,\n PropertiesTable,\n TagPills,\n InventoryBadge,\n} from \"@cimplify/sdk/react\";\nimport { ProductImageGallery } from \"@cimplify/sdk/react\";\nimport { ProductCustomizer } from \"@cimplify/sdk/react\";\nimport { resolveGallery } from \"../../gallery\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { PriceRange } from \"@cimplify/sdk/react\";\nimport { AvailabilityBadge } from \"@cimplify/sdk/react\";\nimport { SaleBadge } from \"@cimplify/sdk/react\";\nimport { parsePrice, isOnSale, getBasePrice, getDiscountPercentage } from \"@cimplify/sdk\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport function DefaultProductLayout({\n product,\n onAddToCart,\n renderBreadcrumb,\n relatedProducts,\n showRelated = true,\n className,\n}: ProductLayoutProps): React.ReactElement {\n const [selectedVariantId, setSelectedVariantId] = React.useState<string | undefined>();\n const images = resolveGallery(product, selectedVariantId);\n const hasRange = (product.quantity_pricing && product.quantity_pricing.length > 1)\n || (product.variants && product.variants.length > 1);\n const onSale = isOnSale(product);\n const hasPhysicalDetails = product.sku || product.vendor || product.material;\n\n return (\n <div data-cimplify-product-layout=\"default\" className={cn(\"space-y-8\", className)}>\n {renderBreadcrumb?.(product)}\n\n <TwoColumnGrid\n left={\n <ProductImageGallery\n images={images}\n productName={product.name}\n />\n }\n right={\n <div className=\"space-y-6\">\n {/* Brand + Tags */}\n <div className=\"flex flex-wrap items-center gap-2\">\n {product.vendor && (\n <span className=\"text-xs font-semibold text-muted-foreground uppercase tracking-widest\">\n {product.vendor}\n </span>\n )}\n <TagPills tags={product.tags || []} />\n </div>\n\n {/* Name */}\n <h1 data-cimplify-product-layout-name className=\"text-3xl lg:text-4xl font-extrabold tracking-tight\">\n {product.name}\n </h1>\n\n {/* Price */}\n <div className=\"flex items-baseline gap-3\">\n {hasRange ? (\n <PriceRange product={product} className=\"text-2xl font-extrabold\" />\n ) : onSale ? (\n <>\n <Price amount={product.default_price} className=\"text-2xl font-extrabold\" />\n <Price amount={getBasePrice(product)} className=\"text-lg text-muted-foreground line-through\" />\n <span className=\"text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5\">\n Save {getDiscountPercentage(product)}%\n </span>\n </>\n ) : (\n <Price amount={product.default_price} className=\"text-2xl font-semibold\" />\n )}\n </div>\n\n {/* Inventory */}\n <InventoryBadge product={product} />\n\n {/* Description */}\n {product.description && (\n <p data-cimplify-product-layout-description className=\"text-muted-foreground leading-relaxed\">\n {product.description}\n </p>\n )}\n\n {/* Physical product details */}\n {hasPhysicalDetails && (\n <div data-cimplify-product-layout-details className=\"space-y-1 text-sm text-muted-foreground\">\n {product.sku && <p>SKU: <span className=\"font-mono text-foreground\">{product.sku}</span></p>}\n {product.barcode && <p>Barcode: <span className=\"font-mono text-foreground\">{product.barcode}</span></p>}\n {product.material && <p>Material: <span className=\"text-foreground\">{product.material}</span></p>}\n {product.vendor && <p>Brand: <span className=\"text-foreground\">{product.vendor}</span></p>}\n {(product.length_mm || product.width_mm || product.height_mm) && (\n <p>Dimensions: <span className=\"text-foreground\">\n {[product.length_mm, product.width_mm, product.height_mm]\n .filter(Boolean)\n .map((d) => `${(d! / 10).toFixed(1)} cm`)\n .join(\" x \")}\n </span></p>\n )}\n {product.item_condition && product.item_condition !== \"new\" && (\n <p>Condition: <span className=\"text-foreground capitalize\">{product.item_condition}</span></p>\n )}\n </div>\n )}\n\n {/* Custom Attributes */}\n <CustomAttributesTable attributes={product.custom_attributes || []} />\n\n {/* Properties */}\n <PropertiesTable properties={product.properties || []} />\n\n {/* Customizer */}\n <ProductCustomizer\n product={product}\n onAddToCart={onAddToCart}\n onVariantChange={(variantId) => setSelectedVariantId(variantId)}\n />\n </div>\n }\n />\n\n {showRelated && relatedProducts && relatedProducts.length > 0 && (\n <RelatedProductsSection\n products={relatedProducts}\n />\n )}\n </div>\n );\n}\n"
19
19
  }
20
20
  ]
21
21
  }