@cimplify/sdk 0.9.2 → 0.9.3

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,7 +1,10 @@
1
1
  /**
2
2
  * Derive a human-readable display name for a variant.
3
3
  *
4
- * Priority: explicit name display_attributes joined"Default"/"Option" fallback.
4
+ * Priority: display_attributes name (stripped of product prefix) → fallback.
5
+ *
6
+ * Pass `productName` to strip redundant product-name prefixes from variant names
7
+ * (e.g. "Fried rice-Small" → "Small" when productName is "Fried rice").
5
8
  */
6
9
  declare function getVariantDisplayName(variant: {
7
10
  name?: string;
@@ -9,7 +12,7 @@ declare function getVariantDisplayName(variant: {
9
12
  value_name: string;
10
13
  }>;
11
14
  is_default?: boolean;
12
- }): string;
15
+ }, productName?: string): string;
13
16
 
14
17
  type AdSlot = "banner" | "sidebar" | "in-content" | "native" | "footer";
15
18
  type AdPosition = "static" | "sticky" | "fixed";
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Derive a human-readable display name for a variant.
3
3
  *
4
- * Priority: explicit name display_attributes joined"Default"/"Option" fallback.
4
+ * Priority: display_attributes name (stripped of product prefix) → fallback.
5
+ *
6
+ * Pass `productName` to strip redundant product-name prefixes from variant names
7
+ * (e.g. "Fried rice-Small" → "Small" when productName is "Fried rice").
5
8
  */
6
9
  declare function getVariantDisplayName(variant: {
7
10
  name?: string;
@@ -9,7 +12,7 @@ declare function getVariantDisplayName(variant: {
9
12
  value_name: string;
10
13
  }>;
11
14
  is_default?: boolean;
12
- }): string;
15
+ }, productName?: string): string;
13
16
 
14
17
  type AdSlot = "banner" | "sidebar" | "in-content" | "native" | "footer";
15
18
  type AdPosition = "static" | "sticky" | "fixed";
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ export { QueryBuilder, query } from './advanced.mjs';
3
3
  import { A as ApiError } from './payment-DsGQPORm.mjs';
4
4
  export { G as AddOn, av as AddOnDetails, aR as AddOnGroupDetails, J as AddOnOption, aQ as AddOnOptionDetails, K as AddOnOptionPrice, H as AddOnWithOptions, aW as AddToCartInput, ak as AdjustmentType, ar as AppliedDiscount, b0 as AuthorizationType, aq as BenefitType, W as Bundle, $ as BundleComponentData, a0 as BundleComponentInfo, U as BundlePriceType, Y as BundleProduct, aA as BundleSelectionData, ay as BundleSelectionInput, az as BundleStoredSelection, X as BundleSummary, _ as BundleWithDetails, aF as Cart, aw as CartAddOn, ai as CartChannel, aG as CartItem, aT as CartItemDetails, ah as CartStatus, aY as CartSummary, aH as CartTotals, N as Category, O as CategorySummary, ap as ChosenPrice, h as CimplifyError, Q as Collection, T as CollectionProduct, R as CollectionSummary, a6 as ComponentGroup, a7 as ComponentGroupWithComponents, ab as ComponentPriceBreakdown, a9 as ComponentSelectionInput, a3 as ComponentSourceType, a4 as Composite, a8 as CompositeComponent, aC as CompositePriceBreakdown, aa as CompositePriceResult, a1 as CompositePricingMode, aD as CompositeSelectionData, a9 as CompositeSelectionInput, aB as CompositeStoredSelection, a5 as CompositeWithDetails, b as Currency, C as CurrencyCode, r as DepositType, q as DigitalProductType, as as DiscountBreakdown, at as DiscountDetails, aK as DisplayAddOn, aL as DisplayAddOnOption, aI as DisplayCart, aJ as DisplayCartItem, D as DisplayMode, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, a2 as GroupPricingBehavior, b4 as InitializePaymentResult, I as InventoryType, aE as LineConfiguration, ae as LocationProductPrice, M as Money, d as Pagination, P as PaginationParams, b3 as Payment, b7 as PaymentErrorDetails, b2 as PaymentMethod, a$ as PaymentMethodType, b1 as PaymentProcessingState, a_ as PaymentProvider, b5 as PaymentResponse, aZ as PaymentStatus, b6 as PaymentStatusResponse, ad as Price, al as PriceAdjustment, ao as PriceDecisionPath, ac as PriceEntryType, an as PricePathTaxInfo, aj as PriceSource, s as Product, L as ProductAddOn, af as ProductAvailability, p as ProductRenderHint, ag as ProductTimeProfile, o as ProductType, u as ProductVariant, z as ProductVariantValue, t as ProductWithDetails, S as SalesChannel, au as SelectedAddOnOption, b8 as SubmitAuthorizationInput, am as TaxPathComponent, aU as UICart, aM as UICartBusiness, aO as UICartCustomer, aN as UICartLocation, aP as UICartPricing, aV as UICartResponse, aX as UpdateCartItemInput, w as VariantAxis, F as VariantAxisSelection, y as VariantAxisValue, x as VariantAxisWithValues, ax as VariantDetails, aS as VariantDetailsDTO, v as VariantDisplayAttribute, B as VariantLocationAvailability, V as VariantStrategy, Z as ZERO, c as currencyCode, l as enrichError, k as getErrorHint, j as isCimplifyError, n as isRetryableError, i as isSupportedCurrency, m as money, a as moneyFromNumber } from './payment-DsGQPORm.mjs';
5
5
  export { C as CURRENCY_SYMBOLS, B as FormatCompactOptions, F as FormatPriceOptions, M as MOBILE_MONEY_PROVIDERS, P as PriceInfo, A as ProductWithPrice, T as TaxComponent, z as TaxInfo, s as categorizePaymentError, y as detectMobileMoneyProvider, c as formatMoney, d as formatNumberCompact, f as formatPrice, a as formatPriceAdjustment, b as formatPriceCompact, j as formatPriceWithTax, e as formatProductPrice, m as getBasePrice, k as getCurrencySymbol, o as getDiscountPercentage, l as getDisplayPrice, q as getMarkupPercentage, r as getProductCurrency, g as getTaxAmount, h as hasTaxInfo, n as isOnSale, v as isPaymentStatusFailure, w as isPaymentStatusRequiresAction, x as isPaymentStatusSuccess, i as isTaxInclusive, t as normalizePaymentResponse, u as normalizeStatusResponse, p as parsePrice } from './index-4Ke_FJa6.mjs';
6
- export { c as AdConfig, e as AdContextValue, d as AdCreative, a as AdPosition, A as AdSlot, b as AdTheme, g as getVariantDisplayName } from './ads-DeL3PGzf.mjs';
6
+ export { c as AdConfig, e as AdContextValue, d as AdCreative, a as AdPosition, A as AdSlot, b as AdTheme, g as getVariantDisplayName } from './ads-MkGm5l1T.mjs';
7
7
 
8
8
  /** Context sent with every request to scope operations to a specific location/branch */
9
9
  interface FrontendContext {
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { QueryBuilder, query } from './advanced.js';
3
3
  import { A as ApiError } from './payment-DsGQPORm.js';
4
4
  export { G as AddOn, av as AddOnDetails, aR as AddOnGroupDetails, J as AddOnOption, aQ as AddOnOptionDetails, K as AddOnOptionPrice, H as AddOnWithOptions, aW as AddToCartInput, ak as AdjustmentType, ar as AppliedDiscount, b0 as AuthorizationType, aq as BenefitType, W as Bundle, $ as BundleComponentData, a0 as BundleComponentInfo, U as BundlePriceType, Y as BundleProduct, aA as BundleSelectionData, ay as BundleSelectionInput, az as BundleStoredSelection, X as BundleSummary, _ as BundleWithDetails, aF as Cart, aw as CartAddOn, ai as CartChannel, aG as CartItem, aT as CartItemDetails, ah as CartStatus, aY as CartSummary, aH as CartTotals, N as Category, O as CategorySummary, ap as ChosenPrice, h as CimplifyError, Q as Collection, T as CollectionProduct, R as CollectionSummary, a6 as ComponentGroup, a7 as ComponentGroupWithComponents, ab as ComponentPriceBreakdown, a9 as ComponentSelectionInput, a3 as ComponentSourceType, a4 as Composite, a8 as CompositeComponent, aC as CompositePriceBreakdown, aa as CompositePriceResult, a1 as CompositePricingMode, aD as CompositeSelectionData, a9 as CompositeSelectionInput, aB as CompositeStoredSelection, a5 as CompositeWithDetails, b as Currency, C as CurrencyCode, r as DepositType, q as DigitalProductType, as as DiscountBreakdown, at as DiscountDetails, aK as DisplayAddOn, aL as DisplayAddOnOption, aI as DisplayCart, aJ as DisplayCartItem, D as DisplayMode, g as ERROR_HINTS, E as ErrorCode, e as ErrorCodeType, f as ErrorHint, a2 as GroupPricingBehavior, b4 as InitializePaymentResult, I as InventoryType, aE as LineConfiguration, ae as LocationProductPrice, M as Money, d as Pagination, P as PaginationParams, b3 as Payment, b7 as PaymentErrorDetails, b2 as PaymentMethod, a$ as PaymentMethodType, b1 as PaymentProcessingState, a_ as PaymentProvider, b5 as PaymentResponse, aZ as PaymentStatus, b6 as PaymentStatusResponse, ad as Price, al as PriceAdjustment, ao as PriceDecisionPath, ac as PriceEntryType, an as PricePathTaxInfo, aj as PriceSource, s as Product, L as ProductAddOn, af as ProductAvailability, p as ProductRenderHint, ag as ProductTimeProfile, o as ProductType, u as ProductVariant, z as ProductVariantValue, t as ProductWithDetails, S as SalesChannel, au as SelectedAddOnOption, b8 as SubmitAuthorizationInput, am as TaxPathComponent, aU as UICart, aM as UICartBusiness, aO as UICartCustomer, aN as UICartLocation, aP as UICartPricing, aV as UICartResponse, aX as UpdateCartItemInput, w as VariantAxis, F as VariantAxisSelection, y as VariantAxisValue, x as VariantAxisWithValues, ax as VariantDetails, aS as VariantDetailsDTO, v as VariantDisplayAttribute, B as VariantLocationAvailability, V as VariantStrategy, Z as ZERO, c as currencyCode, l as enrichError, k as getErrorHint, j as isCimplifyError, n as isRetryableError, i as isSupportedCurrency, m as money, a as moneyFromNumber } from './payment-DsGQPORm.js';
5
5
  export { C as CURRENCY_SYMBOLS, B as FormatCompactOptions, F as FormatPriceOptions, M as MOBILE_MONEY_PROVIDERS, P as PriceInfo, A as ProductWithPrice, T as TaxComponent, z as TaxInfo, s as categorizePaymentError, y as detectMobileMoneyProvider, c as formatMoney, d as formatNumberCompact, f as formatPrice, a as formatPriceAdjustment, b as formatPriceCompact, j as formatPriceWithTax, e as formatProductPrice, m as getBasePrice, k as getCurrencySymbol, o as getDiscountPercentage, l as getDisplayPrice, q as getMarkupPercentage, r as getProductCurrency, g as getTaxAmount, h as hasTaxInfo, n as isOnSale, v as isPaymentStatusFailure, w as isPaymentStatusRequiresAction, x as isPaymentStatusSuccess, i as isTaxInclusive, t as normalizePaymentResponse, u as normalizeStatusResponse, p as parsePrice } from './index-ynsh8lBa.js';
6
- export { c as AdConfig, e as AdContextValue, d as AdCreative, a as AdPosition, A as AdSlot, b as AdTheme, g as getVariantDisplayName } from './ads-DeL3PGzf.js';
6
+ export { c as AdConfig, e as AdContextValue, d as AdCreative, a as AdPosition, A as AdSlot, b as AdTheme, g as getVariantDisplayName } from './ads-MkGm5l1T.js';
7
7
 
8
8
  /** Context sent with every request to scope operations to a specific location/branch */
9
9
  interface FrontendContext {
package/dist/index.js CHANGED
@@ -4252,12 +4252,26 @@ function query(entity) {
4252
4252
  }
4253
4253
 
4254
4254
  // src/utils/variant.ts
4255
- function getVariantDisplayName(variant) {
4256
- if (variant.name) return variant.name;
4255
+ function stripProductPrefix(variantName, productName) {
4256
+ if (!variantName || !productName) return variantName || productName;
4257
+ const lower = variantName.toLowerCase().trim();
4258
+ if (lower === "default" || lower === "standard") return productName;
4259
+ if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
4260
+ if (variantName.startsWith(productName)) {
4261
+ const rest = variantName.slice(productName.length);
4262
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
4263
+ if (match && match[1].length > 0) return match[1];
4264
+ }
4265
+ return variantName;
4266
+ }
4267
+ function getVariantDisplayName(variant, productName) {
4257
4268
  if (variant.display_attributes?.length) {
4258
4269
  return variant.display_attributes.map((a) => a.value_name).join(" / ");
4259
4270
  }
4260
- return variant.is_default ? "Default" : "Option";
4271
+ if (variant.name) {
4272
+ return productName ? stripProductPrefix(variant.name, productName) : variant.name;
4273
+ }
4274
+ return productName || (variant.is_default ? "Default" : "Option");
4261
4275
  }
4262
4276
 
4263
4277
  exports.AUTHORIZATION_TYPE = AUTHORIZATION_TYPE;
package/dist/index.mjs CHANGED
@@ -4250,12 +4250,26 @@ function query(entity) {
4250
4250
  }
4251
4251
 
4252
4252
  // src/utils/variant.ts
4253
- function getVariantDisplayName(variant) {
4254
- if (variant.name) return variant.name;
4253
+ function stripProductPrefix(variantName, productName) {
4254
+ if (!variantName || !productName) return variantName || productName;
4255
+ const lower = variantName.toLowerCase().trim();
4256
+ if (lower === "default" || lower === "standard") return productName;
4257
+ if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
4258
+ if (variantName.startsWith(productName)) {
4259
+ const rest = variantName.slice(productName.length);
4260
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
4261
+ if (match && match[1].length > 0) return match[1];
4262
+ }
4263
+ return variantName;
4264
+ }
4265
+ function getVariantDisplayName(variant, productName) {
4255
4266
  if (variant.display_attributes?.length) {
4256
4267
  return variant.display_attributes.map((a) => a.value_name).join(" / ");
4257
4268
  }
4258
- return variant.is_default ? "Default" : "Option";
4269
+ if (variant.name) {
4270
+ return productName ? stripProductPrefix(variant.name, productName) : variant.name;
4271
+ }
4272
+ return productName || (variant.is_default ? "Default" : "Option");
4259
4273
  }
4260
4274
 
4261
4275
  export { AUTHORIZATION_TYPE, AUTH_MUTATION, AuthService, BusinessService, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CONTACT_TYPE, CURRENCY_SYMBOLS, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyClient, CimplifyElement, CimplifyElements, CimplifyError, DEFAULT_COUNTRY, DEFAULT_CURRENCY, DEVICE_TYPE, ELEMENT_TYPES, ERROR_HINTS, EVENT_TYPES, ErrorCode, FxService, InventoryService, LINK_MUTATION, LINK_QUERY, LinkService, LiteService, MESSAGE_TYPES, MOBILE_MONEY_PROVIDER, MOBILE_MONEY_PROVIDERS, ORDER_MUTATION, ORDER_TYPE, OrderQueries, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, QueryBuilder, SchedulingService, ZERO, categorizePaymentError, combine, combineObject, createCimplifyClient, createElements, currencyCode, detectMobileMoneyProvider, enrichError, err, flatMap, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatPriceWithTax, formatProductPrice, fromPromise, generateIdempotencyKey, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getErrorHint, getMarkupPercentage, getOrElse, getProductCurrency, getTaxAmount, getVariantDisplayName, hasTaxInfo, isCimplifyError, isErr, isOk, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isRetryableError, isSupportedCurrency, isTaxInclusive, mapError, mapResult, money, moneyFromNumber, normalizePaymentResponse, normalizeStatusResponse, ok, parsePrice, query, toNullable, tryCatch, unwrap };
package/dist/react.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-DeL3PGzf.mjs';
3
- export { c as AdConfig, g as getVariantDisplayName } from './ads-DeL3PGzf.mjs';
2
+ import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-MkGm5l1T.mjs';
3
+ export { c as AdConfig, g as getVariantDisplayName } from './ads-MkGm5l1T.mjs';
4
4
  import { C as CimplifyClient, Y as ProcessCheckoutResult, _ as CheckoutStatus, $ as CheckoutStatusContext, bq as Location, bn as Business, aS as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, w as ElementsOptions, cK as AuthenticatedData, cG as AddressInfo, cH as PaymentMethodInfo, s as CimplifyElements, cM as ElementsCheckoutResult, X as ProcessCheckoutOptions } from './client-D_3KMWI_.mjs';
5
5
  import { s as Product, d as Pagination, h as CimplifyError, t as ProductWithDetails, N as Category, ay as BundleSelectionInput, a9 as ComponentSelectionInput, Q as Collection, _ as BundleWithDetails, a5 as CompositeWithDetails, aa as CompositePriceResult, C as CurrencyCode, u as ProductVariant, x as VariantAxisWithValues, M as Money, H as AddOnWithOptions } from './payment-DsGQPORm.mjs';
6
6
 
@@ -424,6 +424,7 @@ interface VariantSelectorProps {
424
424
  basePrice?: Money;
425
425
  selectedVariantId?: string;
426
426
  onVariantChange: (variantId: string | undefined, variant: ProductVariant | undefined) => void;
427
+ productName?: string;
427
428
  className?: string;
428
429
  }
429
430
  /**
@@ -432,7 +433,7 @@ interface VariantSelectorProps {
432
433
  * Axis mode: one row of chips per axis (e.g. Size, Temperature).
433
434
  * Direct mode: a vertical list showing variant name + full effective price.
434
435
  */
435
- declare function VariantSelector({ variants, variantAxes, basePrice, selectedVariantId, onVariantChange, className, }: VariantSelectorProps): React.ReactElement | null;
436
+ declare function VariantSelector({ variants, variantAxes, basePrice, selectedVariantId, onVariantChange, productName, className, }: VariantSelectorProps): React.ReactElement | null;
436
437
 
437
438
  interface AddOnSelectorProps {
438
439
  addOns: AddOnWithOptions[];
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-DeL3PGzf.js';
3
- export { c as AdConfig, g as getVariantDisplayName } from './ads-DeL3PGzf.js';
2
+ import { A as AdSlot, a as AdPosition, e as AdContextValue } from './ads-MkGm5l1T.js';
3
+ export { c as AdConfig, g as getVariantDisplayName } from './ads-MkGm5l1T.js';
4
4
  import { C as CimplifyClient, Y as ProcessCheckoutResult, _ as CheckoutStatus, $ as CheckoutStatusContext, bq as Location, bn as Business, aS as Order, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, P as PriceQuote, g as QuoteUiMessage, w as ElementsOptions, cK as AuthenticatedData, cG as AddressInfo, cH as PaymentMethodInfo, s as CimplifyElements, cM as ElementsCheckoutResult, X as ProcessCheckoutOptions } from './client-BFqLTbxI.js';
5
5
  import { s as Product, d as Pagination, h as CimplifyError, t as ProductWithDetails, N as Category, ay as BundleSelectionInput, a9 as ComponentSelectionInput, Q as Collection, _ as BundleWithDetails, a5 as CompositeWithDetails, aa as CompositePriceResult, C as CurrencyCode, u as ProductVariant, x as VariantAxisWithValues, M as Money, H as AddOnWithOptions } from './payment-DsGQPORm.js';
6
6
 
@@ -424,6 +424,7 @@ interface VariantSelectorProps {
424
424
  basePrice?: Money;
425
425
  selectedVariantId?: string;
426
426
  onVariantChange: (variantId: string | undefined, variant: ProductVariant | undefined) => void;
427
+ productName?: string;
427
428
  className?: string;
428
429
  }
429
430
  /**
@@ -432,7 +433,7 @@ interface VariantSelectorProps {
432
433
  * Axis mode: one row of chips per axis (e.g. Size, Temperature).
433
434
  * Direct mode: a vertical list showing variant name + full effective price.
434
435
  */
435
- declare function VariantSelector({ variants, variantAxes, basePrice, selectedVariantId, onVariantChange, className, }: VariantSelectorProps): React.ReactElement | null;
436
+ declare function VariantSelector({ variants, variantAxes, basePrice, selectedVariantId, onVariantChange, productName, className, }: VariantSelectorProps): React.ReactElement | null;
436
437
 
437
438
  interface AddOnSelectorProps {
438
439
  addOns: AddOnWithOptions[];
package/dist/react.js CHANGED
@@ -6799,12 +6799,26 @@ function QuantitySelector({
6799
6799
  }
6800
6800
 
6801
6801
  // src/utils/variant.ts
6802
- function getVariantDisplayName(variant) {
6803
- if (variant.name) return variant.name;
6802
+ function stripProductPrefix(variantName, productName) {
6803
+ if (!variantName || !productName) return variantName || productName;
6804
+ const lower = variantName.toLowerCase().trim();
6805
+ if (lower === "default" || lower === "standard") return productName;
6806
+ if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
6807
+ if (variantName.startsWith(productName)) {
6808
+ const rest = variantName.slice(productName.length);
6809
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
6810
+ if (match && match[1].length > 0) return match[1];
6811
+ }
6812
+ return variantName;
6813
+ }
6814
+ function getVariantDisplayName(variant, productName) {
6804
6815
  if (variant.display_attributes?.length) {
6805
6816
  return variant.display_attributes.map((a) => a.value_name).join(" / ");
6806
6817
  }
6807
- return variant.is_default ? "Default" : "Option";
6818
+ if (variant.name) {
6819
+ return productName ? stripProductPrefix(variant.name, productName) : variant.name;
6820
+ }
6821
+ return productName || (variant.is_default ? "Default" : "Option");
6808
6822
  }
6809
6823
  function VariantSelector({
6810
6824
  variants,
@@ -6812,6 +6826,7 @@ function VariantSelector({
6812
6826
  basePrice,
6813
6827
  selectedVariantId,
6814
6828
  onVariantChange,
6829
+ productName,
6815
6830
  className
6816
6831
  }) {
6817
6832
  const [axisSelections, setAxisSelections] = React3.useState({});
@@ -6891,7 +6906,7 @@ function VariantSelector({
6891
6906
  "data-cimplify-variant-option": true,
6892
6907
  "data-selected": isSelected || void 0,
6893
6908
  children: [
6894
- /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-variant-name": true, children: getVariantDisplayName(variant) }),
6909
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-variant-name": true, children: getVariantDisplayName(variant, productName) }),
6895
6910
  /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, children: [
6896
6911
  adjustment !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-adjustment": true, children: [
6897
6912
  adjustment > 0 ? "+" : "",
@@ -7284,7 +7299,7 @@ function BundleComponentCard({
7284
7299
  "data-cimplify-bundle-variant-option": true,
7285
7300
  "data-selected": isSelected || void 0,
7286
7301
  children: [
7287
- getVariantDisplayName(variant),
7302
+ getVariantDisplayName(variant, product.name),
7288
7303
  adjustment !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-bundle-variant-adjustment": true, children: [
7289
7304
  adjustment > 0 ? "+" : "",
7290
7305
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: variant.price_adjustment })
@@ -7618,7 +7633,7 @@ function CartSummary({
7618
7633
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item": true, children: [
7619
7634
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, children: [
7620
7635
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-name": true, children: item.product.name }),
7621
- item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: getVariantDisplayName(item.variant) }),
7636
+ item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: getVariantDisplayName(item.variant, item.product.name) }),
7622
7637
  item.addOnOptions && item.addOnOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-cart-item-addons": true, children: [
7623
7638
  "+ ",
7624
7639
  item.addOnOptions.map((opt) => opt.name).join(", ")
package/dist/react.mjs CHANGED
@@ -6793,12 +6793,26 @@ function QuantitySelector({
6793
6793
  }
6794
6794
 
6795
6795
  // src/utils/variant.ts
6796
- function getVariantDisplayName(variant) {
6797
- if (variant.name) return variant.name;
6796
+ function stripProductPrefix(variantName, productName) {
6797
+ if (!variantName || !productName) return variantName || productName;
6798
+ const lower = variantName.toLowerCase().trim();
6799
+ if (lower === "default" || lower === "standard") return productName;
6800
+ if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
6801
+ if (variantName.startsWith(productName)) {
6802
+ const rest = variantName.slice(productName.length);
6803
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
6804
+ if (match && match[1].length > 0) return match[1];
6805
+ }
6806
+ return variantName;
6807
+ }
6808
+ function getVariantDisplayName(variant, productName) {
6798
6809
  if (variant.display_attributes?.length) {
6799
6810
  return variant.display_attributes.map((a) => a.value_name).join(" / ");
6800
6811
  }
6801
- return variant.is_default ? "Default" : "Option";
6812
+ if (variant.name) {
6813
+ return productName ? stripProductPrefix(variant.name, productName) : variant.name;
6814
+ }
6815
+ return productName || (variant.is_default ? "Default" : "Option");
6802
6816
  }
6803
6817
  function VariantSelector({
6804
6818
  variants,
@@ -6806,6 +6820,7 @@ function VariantSelector({
6806
6820
  basePrice,
6807
6821
  selectedVariantId,
6808
6822
  onVariantChange,
6823
+ productName,
6809
6824
  className
6810
6825
  }) {
6811
6826
  const [axisSelections, setAxisSelections] = useState({});
@@ -6885,7 +6900,7 @@ function VariantSelector({
6885
6900
  "data-cimplify-variant-option": true,
6886
6901
  "data-selected": isSelected || void 0,
6887
6902
  children: [
6888
- /* @__PURE__ */ jsx("span", { "data-cimplify-variant-name": true, children: getVariantDisplayName(variant) }),
6903
+ /* @__PURE__ */ jsx("span", { "data-cimplify-variant-name": true, children: getVariantDisplayName(variant, productName) }),
6889
6904
  /* @__PURE__ */ jsxs("span", { "data-cimplify-variant-pricing": true, children: [
6890
6905
  adjustment !== 0 && /* @__PURE__ */ jsxs("span", { "data-cimplify-variant-adjustment": true, children: [
6891
6906
  adjustment > 0 ? "+" : "",
@@ -7278,7 +7293,7 @@ function BundleComponentCard({
7278
7293
  "data-cimplify-bundle-variant-option": true,
7279
7294
  "data-selected": isSelected || void 0,
7280
7295
  children: [
7281
- getVariantDisplayName(variant),
7296
+ getVariantDisplayName(variant, product.name),
7282
7297
  adjustment !== 0 && /* @__PURE__ */ jsxs("span", { "data-cimplify-bundle-variant-adjustment": true, children: [
7283
7298
  adjustment > 0 ? "+" : "",
7284
7299
  /* @__PURE__ */ jsx(Price, { amount: variant.price_adjustment })
@@ -7612,7 +7627,7 @@ function CartSummary({
7612
7627
  return /* @__PURE__ */ jsxs("div", { "data-cimplify-cart-item": true, children: [
7613
7628
  /* @__PURE__ */ jsxs("div", { "data-cimplify-cart-item-info": true, children: [
7614
7629
  /* @__PURE__ */ jsx("span", { "data-cimplify-cart-item-name": true, children: item.product.name }),
7615
- item.variant && /* @__PURE__ */ jsx("span", { "data-cimplify-cart-item-variant": true, children: getVariantDisplayName(item.variant) }),
7630
+ item.variant && /* @__PURE__ */ jsx("span", { "data-cimplify-cart-item-variant": true, children: getVariantDisplayName(item.variant, item.product.name) }),
7616
7631
  item.addOnOptions && item.addOnOptions.length > 0 && /* @__PURE__ */ jsxs("span", { "data-cimplify-cart-item-addons": true, children: [
7617
7632
  "+ ",
7618
7633
  item.addOnOptions.map((opt) => opt.name).join(", ")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",