brainerce 1.11.3 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -135,6 +135,23 @@ interface StoreInfo {
135
135
  * 3. Call verifyEmail(code) with the code they received via email
136
136
  */
137
137
  requireEmailVerification?: boolean;
138
+ /** Upsell feature settings (storefront mode) */
139
+ upsell?: UpsellSettings;
140
+ }
141
+ /** Upsell feature configuration exposed to the storefront */
142
+ interface UpsellSettings {
143
+ /** Minimum cart amount for free shipping (null = disabled) */
144
+ freeShippingThreshold: number | null;
145
+ /** Show free shipping progress bar in cart */
146
+ freeShippingBarEnabled: boolean;
147
+ /** Show "Frequently Bought Together" on product page */
148
+ frequentlyBoughtTogetherEnabled: boolean;
149
+ /** Show upgrade banner per cart item */
150
+ cartUpgradeBannerEnabled: boolean;
151
+ /** Show bundle offers in cart */
152
+ cartBundleEnabled: boolean;
153
+ /** Show order bump checkbox at checkout */
154
+ checkoutOrderBumpEnabled: boolean;
138
155
  }
139
156
  interface CustomerProfile {
140
157
  id: string;
@@ -220,7 +237,7 @@ interface Product {
220
237
  menuOrder?: number | null;
221
238
  /** Tax behavior: 'taxable' follows store setting, 'exempt' always skips tax */
222
239
  taxBehavior?: 'taxable' | 'exempt';
223
- /** Full attribute options for variant selection (admin mode only) */
240
+ /** Full attribute options for variant selection (admin, storefront, and vibe-coded modes) */
224
241
  productAttributeOptions?: Array<{
225
242
  id: string;
226
243
  attributeId: string;
@@ -1354,10 +1371,19 @@ interface CartItem {
1354
1371
  */
1355
1372
  unitPrice: string;
1356
1373
  /**
1357
- * Discount amount applied to this item as a string.
1374
+ * Discount amount applied to this item as a string (from discount rules).
1358
1375
  * Use parseFloat() for calculations.
1359
1376
  */
1360
1377
  discountAmount: string;
1378
+ /**
1379
+ * Promo discount amount from bundle offers or order bumps as a string.
1380
+ * Use parseFloat() for calculations.
1381
+ */
1382
+ promoDiscountAmount: string;
1383
+ /** Promo source: "BUNDLE" or "ORDER_BUMP", null if no promo */
1384
+ promoSource?: string | null;
1385
+ /** ID of the BundleOffer or OrderBumpConfig that gave this discount */
1386
+ promoSourceId?: string | null;
1361
1387
  /** Optional notes for this line item */
1362
1388
  notes?: string | null;
1363
1389
  /** Optional metadata for this line item */
@@ -1442,6 +1468,8 @@ interface Cart {
1442
1468
  couponCode?: string | null;
1443
1469
  /** Discount amount from automatic rules only (before coupon) */
1444
1470
  ruleDiscountAmount?: string;
1471
+ /** Total promo discount from bundle offers and order bumps */
1472
+ promoDiscountTotal?: string;
1445
1473
  /** Automatic discounts applied by discount rules */
1446
1474
  appliedDiscounts?: CartAppliedDiscount[];
1447
1475
  /** Nudges for nearly-qualifying discount rules */
@@ -3544,6 +3572,44 @@ interface ProductRecommendationsResponse {
3544
3572
  interface CartRecommendationsResponse {
3545
3573
  recommendations: ProductRecommendation[];
3546
3574
  }
3575
+ interface CartUpgradeSuggestion {
3576
+ sourceProductId: string;
3577
+ targetProduct: ProductRecommendation;
3578
+ priceDelta: string;
3579
+ deltaPercent: number;
3580
+ }
3581
+ interface CartUpgradesResponse {
3582
+ upgrades: Record<string, CartUpgradeSuggestion>;
3583
+ }
3584
+ interface CartBundleOffer {
3585
+ id: string;
3586
+ name: string;
3587
+ description: string | null;
3588
+ sourceProductId: string;
3589
+ bundleProduct: ProductRecommendation;
3590
+ bundleVariantId: string | null;
3591
+ discountType: 'PERCENTAGE' | 'FIXED_AMOUNT';
3592
+ discountValue: string;
3593
+ originalPrice: string;
3594
+ discountedPrice: string;
3595
+ }
3596
+ interface CartBundlesResponse {
3597
+ bundles: CartBundleOffer[];
3598
+ }
3599
+ interface OrderBump {
3600
+ id: string;
3601
+ title: string;
3602
+ description: string | null;
3603
+ bumpProduct: ProductRecommendation;
3604
+ bumpVariantId: string | null;
3605
+ originalPrice: string;
3606
+ discountedPrice: string | null;
3607
+ discountType: string | null;
3608
+ discountValue: string | null;
3609
+ }
3610
+ interface CheckoutBumpsResponse {
3611
+ bumps: OrderBump[];
3612
+ }
3547
3613
  interface BrainerceApiError {
3548
3614
  statusCode: number;
3549
3615
  message: string;
@@ -4807,6 +4873,83 @@ declare class BrainerceClient {
4807
4873
  * ```
4808
4874
  */
4809
4875
  getCartRecommendations(cartId: string, limit?: number): Promise<CartRecommendationsResponse>;
4876
+ /**
4877
+ * Get upgrade suggestions for cart items (upsell relations with small price delta).
4878
+ * Returns a map keyed by source product ID with the best upgrade option.
4879
+ *
4880
+ * @param cartId - Cart ID
4881
+ * @returns Map of upgrade suggestions keyed by source product ID
4882
+ *
4883
+ * @example
4884
+ * ```typescript
4885
+ * const { upgrades } = await client.getCartUpgrades('cart_123');
4886
+ * for (const [productId, suggestion] of Object.entries(upgrades)) {
4887
+ * console.log(`Upgrade from ${productId} to ${suggestion.targetProduct.name} for +$${suggestion.priceDelta}`);
4888
+ * }
4889
+ * ```
4890
+ */
4891
+ getCartUpgrades(cartId: string): Promise<CartUpgradesResponse>;
4892
+ /**
4893
+ * Get matching bundle offers for cart items.
4894
+ * Returns bundle products with discounted prices for items currently in the cart.
4895
+ *
4896
+ * @param cartId - Cart ID
4897
+ * @returns Array of bundle offers
4898
+ *
4899
+ * @example
4900
+ * ```typescript
4901
+ * const { bundles } = await client.getCartBundles('cart_123');
4902
+ * bundles.forEach(b => {
4903
+ * console.log(`Add ${b.bundleProduct.name} and save! Was ${b.originalPrice}, now ${b.discountedPrice}`);
4904
+ * });
4905
+ * ```
4906
+ */
4907
+ getCartBundles(cartId: string): Promise<CartBundlesResponse>;
4908
+ /**
4909
+ * Get matching order bumps for a checkout session.
4910
+ *
4911
+ * @param checkoutId - Checkout ID
4912
+ * @returns Array of order bumps
4913
+ */
4914
+ getCheckoutBumps(checkoutId: string): Promise<CheckoutBumpsResponse>;
4915
+ /**
4916
+ * Add an order bump to the cart.
4917
+ *
4918
+ * @param cartId - Cart ID
4919
+ * @param bumpConfigId - Order bump config ID
4920
+ * @returns Updated cart
4921
+ */
4922
+ addOrderBump(cartId: string, bumpConfigId: string): Promise<Cart>;
4923
+ /**
4924
+ * Remove an order bump from the cart.
4925
+ *
4926
+ * @param cartId - Cart ID
4927
+ * @param bumpConfigId - Order bump config ID
4928
+ * @returns Updated cart
4929
+ */
4930
+ removeOrderBump(cartId: string, bumpConfigId: string): Promise<Cart>;
4931
+ /**
4932
+ * Add a bundle offer product to the cart with its discount applied.
4933
+ *
4934
+ * @param cartId - Cart ID
4935
+ * @param bundleOfferId - Bundle offer ID
4936
+ * @returns Updated cart
4937
+ *
4938
+ * @example
4939
+ * ```typescript
4940
+ * const { bundles } = await client.getCartBundles('cart_123');
4941
+ * const cart = await client.addBundleToCart('cart_123', bundles[0].id);
4942
+ * ```
4943
+ */
4944
+ addBundleToCart(cartId: string, bundleOfferId: string): Promise<Cart>;
4945
+ /**
4946
+ * Remove a bundle offer product from the cart.
4947
+ *
4948
+ * @param cartId - Cart ID
4949
+ * @param bundleOfferId - Bundle offer ID
4950
+ * @returns Updated cart
4951
+ */
4952
+ removeBundleFromCart(cartId: string, bundleOfferId: string): Promise<Cart>;
4810
4953
  /**
4811
4954
  * Check if customer is currently authenticated
4812
4955
  * Used internally by smart cart methods to determine storage strategy
@@ -6601,4 +6744,4 @@ declare function enableDevGuards(options?: {
6601
6744
  force?: boolean;
6602
6745
  }): void;
6603
6746
 
6604
- export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailVerificationResponse, type ExtendReservationResponse, type FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PickupLocation, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
6747
+ export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailVerificationResponse, type ExtendReservationResponse, type FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PickupLocation, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
package/dist/index.d.ts CHANGED
@@ -135,6 +135,23 @@ interface StoreInfo {
135
135
  * 3. Call verifyEmail(code) with the code they received via email
136
136
  */
137
137
  requireEmailVerification?: boolean;
138
+ /** Upsell feature settings (storefront mode) */
139
+ upsell?: UpsellSettings;
140
+ }
141
+ /** Upsell feature configuration exposed to the storefront */
142
+ interface UpsellSettings {
143
+ /** Minimum cart amount for free shipping (null = disabled) */
144
+ freeShippingThreshold: number | null;
145
+ /** Show free shipping progress bar in cart */
146
+ freeShippingBarEnabled: boolean;
147
+ /** Show "Frequently Bought Together" on product page */
148
+ frequentlyBoughtTogetherEnabled: boolean;
149
+ /** Show upgrade banner per cart item */
150
+ cartUpgradeBannerEnabled: boolean;
151
+ /** Show bundle offers in cart */
152
+ cartBundleEnabled: boolean;
153
+ /** Show order bump checkbox at checkout */
154
+ checkoutOrderBumpEnabled: boolean;
138
155
  }
139
156
  interface CustomerProfile {
140
157
  id: string;
@@ -220,7 +237,7 @@ interface Product {
220
237
  menuOrder?: number | null;
221
238
  /** Tax behavior: 'taxable' follows store setting, 'exempt' always skips tax */
222
239
  taxBehavior?: 'taxable' | 'exempt';
223
- /** Full attribute options for variant selection (admin mode only) */
240
+ /** Full attribute options for variant selection (admin, storefront, and vibe-coded modes) */
224
241
  productAttributeOptions?: Array<{
225
242
  id: string;
226
243
  attributeId: string;
@@ -1354,10 +1371,19 @@ interface CartItem {
1354
1371
  */
1355
1372
  unitPrice: string;
1356
1373
  /**
1357
- * Discount amount applied to this item as a string.
1374
+ * Discount amount applied to this item as a string (from discount rules).
1358
1375
  * Use parseFloat() for calculations.
1359
1376
  */
1360
1377
  discountAmount: string;
1378
+ /**
1379
+ * Promo discount amount from bundle offers or order bumps as a string.
1380
+ * Use parseFloat() for calculations.
1381
+ */
1382
+ promoDiscountAmount: string;
1383
+ /** Promo source: "BUNDLE" or "ORDER_BUMP", null if no promo */
1384
+ promoSource?: string | null;
1385
+ /** ID of the BundleOffer or OrderBumpConfig that gave this discount */
1386
+ promoSourceId?: string | null;
1361
1387
  /** Optional notes for this line item */
1362
1388
  notes?: string | null;
1363
1389
  /** Optional metadata for this line item */
@@ -1442,6 +1468,8 @@ interface Cart {
1442
1468
  couponCode?: string | null;
1443
1469
  /** Discount amount from automatic rules only (before coupon) */
1444
1470
  ruleDiscountAmount?: string;
1471
+ /** Total promo discount from bundle offers and order bumps */
1472
+ promoDiscountTotal?: string;
1445
1473
  /** Automatic discounts applied by discount rules */
1446
1474
  appliedDiscounts?: CartAppliedDiscount[];
1447
1475
  /** Nudges for nearly-qualifying discount rules */
@@ -3544,6 +3572,44 @@ interface ProductRecommendationsResponse {
3544
3572
  interface CartRecommendationsResponse {
3545
3573
  recommendations: ProductRecommendation[];
3546
3574
  }
3575
+ interface CartUpgradeSuggestion {
3576
+ sourceProductId: string;
3577
+ targetProduct: ProductRecommendation;
3578
+ priceDelta: string;
3579
+ deltaPercent: number;
3580
+ }
3581
+ interface CartUpgradesResponse {
3582
+ upgrades: Record<string, CartUpgradeSuggestion>;
3583
+ }
3584
+ interface CartBundleOffer {
3585
+ id: string;
3586
+ name: string;
3587
+ description: string | null;
3588
+ sourceProductId: string;
3589
+ bundleProduct: ProductRecommendation;
3590
+ bundleVariantId: string | null;
3591
+ discountType: 'PERCENTAGE' | 'FIXED_AMOUNT';
3592
+ discountValue: string;
3593
+ originalPrice: string;
3594
+ discountedPrice: string;
3595
+ }
3596
+ interface CartBundlesResponse {
3597
+ bundles: CartBundleOffer[];
3598
+ }
3599
+ interface OrderBump {
3600
+ id: string;
3601
+ title: string;
3602
+ description: string | null;
3603
+ bumpProduct: ProductRecommendation;
3604
+ bumpVariantId: string | null;
3605
+ originalPrice: string;
3606
+ discountedPrice: string | null;
3607
+ discountType: string | null;
3608
+ discountValue: string | null;
3609
+ }
3610
+ interface CheckoutBumpsResponse {
3611
+ bumps: OrderBump[];
3612
+ }
3547
3613
  interface BrainerceApiError {
3548
3614
  statusCode: number;
3549
3615
  message: string;
@@ -4807,6 +4873,83 @@ declare class BrainerceClient {
4807
4873
  * ```
4808
4874
  */
4809
4875
  getCartRecommendations(cartId: string, limit?: number): Promise<CartRecommendationsResponse>;
4876
+ /**
4877
+ * Get upgrade suggestions for cart items (upsell relations with small price delta).
4878
+ * Returns a map keyed by source product ID with the best upgrade option.
4879
+ *
4880
+ * @param cartId - Cart ID
4881
+ * @returns Map of upgrade suggestions keyed by source product ID
4882
+ *
4883
+ * @example
4884
+ * ```typescript
4885
+ * const { upgrades } = await client.getCartUpgrades('cart_123');
4886
+ * for (const [productId, suggestion] of Object.entries(upgrades)) {
4887
+ * console.log(`Upgrade from ${productId} to ${suggestion.targetProduct.name} for +$${suggestion.priceDelta}`);
4888
+ * }
4889
+ * ```
4890
+ */
4891
+ getCartUpgrades(cartId: string): Promise<CartUpgradesResponse>;
4892
+ /**
4893
+ * Get matching bundle offers for cart items.
4894
+ * Returns bundle products with discounted prices for items currently in the cart.
4895
+ *
4896
+ * @param cartId - Cart ID
4897
+ * @returns Array of bundle offers
4898
+ *
4899
+ * @example
4900
+ * ```typescript
4901
+ * const { bundles } = await client.getCartBundles('cart_123');
4902
+ * bundles.forEach(b => {
4903
+ * console.log(`Add ${b.bundleProduct.name} and save! Was ${b.originalPrice}, now ${b.discountedPrice}`);
4904
+ * });
4905
+ * ```
4906
+ */
4907
+ getCartBundles(cartId: string): Promise<CartBundlesResponse>;
4908
+ /**
4909
+ * Get matching order bumps for a checkout session.
4910
+ *
4911
+ * @param checkoutId - Checkout ID
4912
+ * @returns Array of order bumps
4913
+ */
4914
+ getCheckoutBumps(checkoutId: string): Promise<CheckoutBumpsResponse>;
4915
+ /**
4916
+ * Add an order bump to the cart.
4917
+ *
4918
+ * @param cartId - Cart ID
4919
+ * @param bumpConfigId - Order bump config ID
4920
+ * @returns Updated cart
4921
+ */
4922
+ addOrderBump(cartId: string, bumpConfigId: string): Promise<Cart>;
4923
+ /**
4924
+ * Remove an order bump from the cart.
4925
+ *
4926
+ * @param cartId - Cart ID
4927
+ * @param bumpConfigId - Order bump config ID
4928
+ * @returns Updated cart
4929
+ */
4930
+ removeOrderBump(cartId: string, bumpConfigId: string): Promise<Cart>;
4931
+ /**
4932
+ * Add a bundle offer product to the cart with its discount applied.
4933
+ *
4934
+ * @param cartId - Cart ID
4935
+ * @param bundleOfferId - Bundle offer ID
4936
+ * @returns Updated cart
4937
+ *
4938
+ * @example
4939
+ * ```typescript
4940
+ * const { bundles } = await client.getCartBundles('cart_123');
4941
+ * const cart = await client.addBundleToCart('cart_123', bundles[0].id);
4942
+ * ```
4943
+ */
4944
+ addBundleToCart(cartId: string, bundleOfferId: string): Promise<Cart>;
4945
+ /**
4946
+ * Remove a bundle offer product from the cart.
4947
+ *
4948
+ * @param cartId - Cart ID
4949
+ * @param bundleOfferId - Bundle offer ID
4950
+ * @returns Updated cart
4951
+ */
4952
+ removeBundleFromCart(cartId: string, bundleOfferId: string): Promise<Cart>;
4810
4953
  /**
4811
4954
  * Check if customer is currently authenticated
4812
4955
  * Used internally by smart cart methods to determine storage strategy
@@ -6601,4 +6744,4 @@ declare function enableDevGuards(options?: {
6601
6744
  force?: boolean;
6602
6745
  }): void;
6603
6746
 
6604
- export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailVerificationResponse, type ExtendReservationResponse, type FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PickupLocation, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
6747
+ export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type Attribute, type AttributeOption, type AttributeSource, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundlesResponse, type CartItem, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type Category, type CategoryNode, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateTagDto as CreateTagInput, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type DeleteProductResponse, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailVerificationResponse, type ExtendReservationResponse, type FormatPriceOptions, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type LocalCart, type LocalCartItem, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldPlatformMapping, type MetafieldType, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentStatus, type PickupLocation, type PlatformCouponCapabilities, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type Product, type ProductAttributeInput, type ProductAvailability, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductMetafield, type ProductMetafieldValue, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductSuggestion, type ProductVariant, type PublicMetafieldDefinition, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, SDK_VERSION, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingZone, type ShippingZoneQueryParams, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type UpdateAddressDto, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, createWebhookHandler, enableDevGuards, formatPrice, getCartItemImage, getCartItemName, getCartTotals, getDescriptionContent, formatPrice as getPriceDisplay, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isCouponApplicableToProduct, isHtmlDescription, isWebhookEventType, parseWebhookEvent, verifyWebhook };
package/dist/index.js CHANGED
@@ -2424,6 +2424,139 @@ var BrainerceClient = class {
2424
2424
  400
2425
2425
  );
2426
2426
  }
2427
+ /**
2428
+ * Get upgrade suggestions for cart items (upsell relations with small price delta).
2429
+ * Returns a map keyed by source product ID with the best upgrade option.
2430
+ *
2431
+ * @param cartId - Cart ID
2432
+ * @returns Map of upgrade suggestions keyed by source product ID
2433
+ *
2434
+ * @example
2435
+ * ```typescript
2436
+ * const { upgrades } = await client.getCartUpgrades('cart_123');
2437
+ * for (const [productId, suggestion] of Object.entries(upgrades)) {
2438
+ * console.log(`Upgrade from ${productId} to ${suggestion.targetProduct.name} for +$${suggestion.priceDelta}`);
2439
+ * }
2440
+ * ```
2441
+ */
2442
+ async getCartUpgrades(cartId) {
2443
+ if (this.isVibeCodedMode()) {
2444
+ return this.vibeCodedRequest("GET", `/cart/${cartId}/upgrades`);
2445
+ }
2446
+ if (this.storeId && !this.apiKey) {
2447
+ return this.storefrontRequest("GET", `/cart/${cartId}/upgrades`);
2448
+ }
2449
+ throw new BrainerceError("getCartUpgrades() requires vibe-coded or storefront mode", 400);
2450
+ }
2451
+ /**
2452
+ * Get matching bundle offers for cart items.
2453
+ * Returns bundle products with discounted prices for items currently in the cart.
2454
+ *
2455
+ * @param cartId - Cart ID
2456
+ * @returns Array of bundle offers
2457
+ *
2458
+ * @example
2459
+ * ```typescript
2460
+ * const { bundles } = await client.getCartBundles('cart_123');
2461
+ * bundles.forEach(b => {
2462
+ * console.log(`Add ${b.bundleProduct.name} and save! Was ${b.originalPrice}, now ${b.discountedPrice}`);
2463
+ * });
2464
+ * ```
2465
+ */
2466
+ async getCartBundles(cartId) {
2467
+ if (this.isVibeCodedMode()) {
2468
+ return this.vibeCodedRequest("GET", `/cart/${cartId}/bundles`);
2469
+ }
2470
+ if (this.storeId && !this.apiKey) {
2471
+ return this.storefrontRequest("GET", `/cart/${cartId}/bundles`);
2472
+ }
2473
+ throw new BrainerceError("getCartBundles() requires vibe-coded or storefront mode", 400);
2474
+ }
2475
+ /**
2476
+ * Get matching order bumps for a checkout session.
2477
+ *
2478
+ * @param checkoutId - Checkout ID
2479
+ * @returns Array of order bumps
2480
+ */
2481
+ async getCheckoutBumps(checkoutId) {
2482
+ if (this.isVibeCodedMode()) {
2483
+ return this.vibeCodedRequest("GET", `/checkout/${checkoutId}/bumps`);
2484
+ }
2485
+ if (this.storeId && !this.apiKey) {
2486
+ return this.storefrontRequest("GET", `/checkout/${checkoutId}/bumps`);
2487
+ }
2488
+ throw new BrainerceError("getCheckoutBumps() requires vibe-coded or storefront mode", 400);
2489
+ }
2490
+ /**
2491
+ * Add an order bump to the cart.
2492
+ *
2493
+ * @param cartId - Cart ID
2494
+ * @param bumpConfigId - Order bump config ID
2495
+ * @returns Updated cart
2496
+ */
2497
+ async addOrderBump(cartId, bumpConfigId) {
2498
+ if (this.isVibeCodedMode()) {
2499
+ return this.vibeCodedRequest("POST", `/cart/${cartId}/bump`, { bumpConfigId });
2500
+ }
2501
+ if (this.storeId && !this.apiKey) {
2502
+ return this.storefrontRequest("POST", `/cart/${cartId}/bump`, { bumpConfigId });
2503
+ }
2504
+ throw new BrainerceError("addOrderBump() requires vibe-coded or storefront mode", 400);
2505
+ }
2506
+ /**
2507
+ * Remove an order bump from the cart.
2508
+ *
2509
+ * @param cartId - Cart ID
2510
+ * @param bumpConfigId - Order bump config ID
2511
+ * @returns Updated cart
2512
+ */
2513
+ async removeOrderBump(cartId, bumpConfigId) {
2514
+ if (this.isVibeCodedMode()) {
2515
+ return this.vibeCodedRequest("DELETE", `/cart/${cartId}/bump/${bumpConfigId}`);
2516
+ }
2517
+ if (this.storeId && !this.apiKey) {
2518
+ return this.storefrontRequest("DELETE", `/cart/${cartId}/bump/${bumpConfigId}`);
2519
+ }
2520
+ throw new BrainerceError("removeOrderBump() requires vibe-coded or storefront mode", 400);
2521
+ }
2522
+ /**
2523
+ * Add a bundle offer product to the cart with its discount applied.
2524
+ *
2525
+ * @param cartId - Cart ID
2526
+ * @param bundleOfferId - Bundle offer ID
2527
+ * @returns Updated cart
2528
+ *
2529
+ * @example
2530
+ * ```typescript
2531
+ * const { bundles } = await client.getCartBundles('cart_123');
2532
+ * const cart = await client.addBundleToCart('cart_123', bundles[0].id);
2533
+ * ```
2534
+ */
2535
+ async addBundleToCart(cartId, bundleOfferId) {
2536
+ if (this.isVibeCodedMode()) {
2537
+ return this.vibeCodedRequest("POST", `/cart/${cartId}/bundle`, { bundleOfferId });
2538
+ }
2539
+ if (this.storeId && !this.apiKey) {
2540
+ return this.storefrontRequest("POST", `/cart/${cartId}/bundle`, { bundleOfferId });
2541
+ }
2542
+ throw new BrainerceError("addBundleToCart() requires vibe-coded or storefront mode", 400);
2543
+ }
2544
+ /**
2545
+ * Remove a bundle offer product from the cart.
2546
+ *
2547
+ * @param cartId - Cart ID
2548
+ * @param bundleOfferId - Bundle offer ID
2549
+ * @returns Updated cart
2550
+ */
2551
+ async removeBundleFromCart(cartId, bundleOfferId) {
2552
+ if (this.isVibeCodedMode()) {
2553
+ return this.vibeCodedRequest("DELETE", `/cart/${cartId}/bundle/${bundleOfferId}`);
2554
+ }
2555
+ if (this.storeId && !this.apiKey) {
2556
+ return this.storefrontRequest("DELETE", `/cart/${cartId}/bundle/${bundleOfferId}`);
2557
+ }
2558
+ throw new BrainerceError("removeBundleFromCart() requires vibe-coded or storefront mode", 400);
2559
+ }
2427
2560
  // -------------------- Smart Cart (Auto-sync) --------------------
2428
2561
  /**
2429
2562
  * Check if customer is currently authenticated
@@ -3727,6 +3860,9 @@ var BrainerceClient = class {
3727
3860
  quantity: item.quantity,
3728
3861
  unitPrice: item.price || "0",
3729
3862
  discountAmount: "0",
3863
+ promoDiscountAmount: "0",
3864
+ promoSource: null,
3865
+ promoSourceId: null,
3730
3866
  notes: null,
3731
3867
  metadata: null,
3732
3868
  product: {
package/dist/index.mjs CHANGED
@@ -2364,6 +2364,139 @@ var BrainerceClient = class {
2364
2364
  400
2365
2365
  );
2366
2366
  }
2367
+ /**
2368
+ * Get upgrade suggestions for cart items (upsell relations with small price delta).
2369
+ * Returns a map keyed by source product ID with the best upgrade option.
2370
+ *
2371
+ * @param cartId - Cart ID
2372
+ * @returns Map of upgrade suggestions keyed by source product ID
2373
+ *
2374
+ * @example
2375
+ * ```typescript
2376
+ * const { upgrades } = await client.getCartUpgrades('cart_123');
2377
+ * for (const [productId, suggestion] of Object.entries(upgrades)) {
2378
+ * console.log(`Upgrade from ${productId} to ${suggestion.targetProduct.name} for +$${suggestion.priceDelta}`);
2379
+ * }
2380
+ * ```
2381
+ */
2382
+ async getCartUpgrades(cartId) {
2383
+ if (this.isVibeCodedMode()) {
2384
+ return this.vibeCodedRequest("GET", `/cart/${cartId}/upgrades`);
2385
+ }
2386
+ if (this.storeId && !this.apiKey) {
2387
+ return this.storefrontRequest("GET", `/cart/${cartId}/upgrades`);
2388
+ }
2389
+ throw new BrainerceError("getCartUpgrades() requires vibe-coded or storefront mode", 400);
2390
+ }
2391
+ /**
2392
+ * Get matching bundle offers for cart items.
2393
+ * Returns bundle products with discounted prices for items currently in the cart.
2394
+ *
2395
+ * @param cartId - Cart ID
2396
+ * @returns Array of bundle offers
2397
+ *
2398
+ * @example
2399
+ * ```typescript
2400
+ * const { bundles } = await client.getCartBundles('cart_123');
2401
+ * bundles.forEach(b => {
2402
+ * console.log(`Add ${b.bundleProduct.name} and save! Was ${b.originalPrice}, now ${b.discountedPrice}`);
2403
+ * });
2404
+ * ```
2405
+ */
2406
+ async getCartBundles(cartId) {
2407
+ if (this.isVibeCodedMode()) {
2408
+ return this.vibeCodedRequest("GET", `/cart/${cartId}/bundles`);
2409
+ }
2410
+ if (this.storeId && !this.apiKey) {
2411
+ return this.storefrontRequest("GET", `/cart/${cartId}/bundles`);
2412
+ }
2413
+ throw new BrainerceError("getCartBundles() requires vibe-coded or storefront mode", 400);
2414
+ }
2415
+ /**
2416
+ * Get matching order bumps for a checkout session.
2417
+ *
2418
+ * @param checkoutId - Checkout ID
2419
+ * @returns Array of order bumps
2420
+ */
2421
+ async getCheckoutBumps(checkoutId) {
2422
+ if (this.isVibeCodedMode()) {
2423
+ return this.vibeCodedRequest("GET", `/checkout/${checkoutId}/bumps`);
2424
+ }
2425
+ if (this.storeId && !this.apiKey) {
2426
+ return this.storefrontRequest("GET", `/checkout/${checkoutId}/bumps`);
2427
+ }
2428
+ throw new BrainerceError("getCheckoutBumps() requires vibe-coded or storefront mode", 400);
2429
+ }
2430
+ /**
2431
+ * Add an order bump to the cart.
2432
+ *
2433
+ * @param cartId - Cart ID
2434
+ * @param bumpConfigId - Order bump config ID
2435
+ * @returns Updated cart
2436
+ */
2437
+ async addOrderBump(cartId, bumpConfigId) {
2438
+ if (this.isVibeCodedMode()) {
2439
+ return this.vibeCodedRequest("POST", `/cart/${cartId}/bump`, { bumpConfigId });
2440
+ }
2441
+ if (this.storeId && !this.apiKey) {
2442
+ return this.storefrontRequest("POST", `/cart/${cartId}/bump`, { bumpConfigId });
2443
+ }
2444
+ throw new BrainerceError("addOrderBump() requires vibe-coded or storefront mode", 400);
2445
+ }
2446
+ /**
2447
+ * Remove an order bump from the cart.
2448
+ *
2449
+ * @param cartId - Cart ID
2450
+ * @param bumpConfigId - Order bump config ID
2451
+ * @returns Updated cart
2452
+ */
2453
+ async removeOrderBump(cartId, bumpConfigId) {
2454
+ if (this.isVibeCodedMode()) {
2455
+ return this.vibeCodedRequest("DELETE", `/cart/${cartId}/bump/${bumpConfigId}`);
2456
+ }
2457
+ if (this.storeId && !this.apiKey) {
2458
+ return this.storefrontRequest("DELETE", `/cart/${cartId}/bump/${bumpConfigId}`);
2459
+ }
2460
+ throw new BrainerceError("removeOrderBump() requires vibe-coded or storefront mode", 400);
2461
+ }
2462
+ /**
2463
+ * Add a bundle offer product to the cart with its discount applied.
2464
+ *
2465
+ * @param cartId - Cart ID
2466
+ * @param bundleOfferId - Bundle offer ID
2467
+ * @returns Updated cart
2468
+ *
2469
+ * @example
2470
+ * ```typescript
2471
+ * const { bundles } = await client.getCartBundles('cart_123');
2472
+ * const cart = await client.addBundleToCart('cart_123', bundles[0].id);
2473
+ * ```
2474
+ */
2475
+ async addBundleToCart(cartId, bundleOfferId) {
2476
+ if (this.isVibeCodedMode()) {
2477
+ return this.vibeCodedRequest("POST", `/cart/${cartId}/bundle`, { bundleOfferId });
2478
+ }
2479
+ if (this.storeId && !this.apiKey) {
2480
+ return this.storefrontRequest("POST", `/cart/${cartId}/bundle`, { bundleOfferId });
2481
+ }
2482
+ throw new BrainerceError("addBundleToCart() requires vibe-coded or storefront mode", 400);
2483
+ }
2484
+ /**
2485
+ * Remove a bundle offer product from the cart.
2486
+ *
2487
+ * @param cartId - Cart ID
2488
+ * @param bundleOfferId - Bundle offer ID
2489
+ * @returns Updated cart
2490
+ */
2491
+ async removeBundleFromCart(cartId, bundleOfferId) {
2492
+ if (this.isVibeCodedMode()) {
2493
+ return this.vibeCodedRequest("DELETE", `/cart/${cartId}/bundle/${bundleOfferId}`);
2494
+ }
2495
+ if (this.storeId && !this.apiKey) {
2496
+ return this.storefrontRequest("DELETE", `/cart/${cartId}/bundle/${bundleOfferId}`);
2497
+ }
2498
+ throw new BrainerceError("removeBundleFromCart() requires vibe-coded or storefront mode", 400);
2499
+ }
2367
2500
  // -------------------- Smart Cart (Auto-sync) --------------------
2368
2501
  /**
2369
2502
  * Check if customer is currently authenticated
@@ -3667,6 +3800,9 @@ var BrainerceClient = class {
3667
3800
  quantity: item.quantity,
3668
3801
  unitPrice: item.price || "0",
3669
3802
  discountAmount: "0",
3803
+ promoDiscountAmount: "0",
3804
+ promoSource: null,
3805
+ promoSourceId: null,
3670
3806
  notes: null,
3671
3807
  metadata: null,
3672
3808
  product: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainerce",
3
- "version": "1.11.3",
3
+ "version": "1.13.0",
4
4
  "description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",