@dropins/storefront-cart 1.2.3-alpha1 → 1.2.3-alpha3

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.
@@ -19,6 +19,9 @@ export interface MiniCartProps extends HTMLAttributes<HTMLDivElement> {
19
19
  displayAllItems?: boolean;
20
20
  showDiscount?: boolean;
21
21
  showSavings?: boolean;
22
+ enableItemRemoval?: boolean;
23
+ enableQuantityUpdate?: boolean;
24
+ hideHeading?: boolean;
22
25
  }
23
26
  export declare const MiniCart: Container<MiniCartProps, CartModel | null>;
24
27
  //# sourceMappingURL=MiniCart.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as i,jsxs as m,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import{useState as A,useEffect as H,useCallback as R}from"@dropins/tools/preact-compat.js";import{classes as h,VComponent as u,Slot as _}from"@dropins/tools/lib.js";import{g as j}from"../chunks/persisted-data.js";import{events as w}from"@dropins/tools/event-bus.js";import{Button as I,Price as N}from"@dropins/tools/components.js";/* empty css */import{useText as D}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import{s as b}from"../chunks/resetCart.js";import{p as O}from"../chunks/acdl.js";import{u as B}from"../chunks/updateProductsFromCart.js";import"../chunks/CartSummaryGrid.js";import{C as V}from"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/EmptyCart.js";import"../chunks/ChevronDown.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronUp.js";import"../chunks/Coupon.js";import"../chunks/GiftCard.js";const $=({className:f,products:s,productListFooter:l,subtotal:e,subtotalExcludingTaxes:d,preCheckoutSection:n,ctas:o,...x})=>{const p=D({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return i("div",{...x,className:h(["cart-mini-cart",f]),children:s&&m(X,{children:[i("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:s}),l&&i("div",{className:h(["cart-mini-cart__productListFooter"]),"data-testid":"mini-cart-product-list-footer",children:i(u,{node:l})}),m("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[e&&m("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[p.subtotal,i(u,{node:e})]}),d&&m("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[p.subtotalExcludingTaxes,i(u,{node:d,className:h(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),n&&i("div",{className:h(["cart-mini-cart__preCheckoutSection"]),"data-testid":"mini-cart-pre-checkout-section",children:i(u,{node:n})}),o&&i(u,{node:o,className:"cart-mini-cart__footer__ctas"})]})]})})},q=({children:f,initialData:s=null,hideFooter:l=!0,slots:e,routeProduct:d,routeCart:n,routeCheckout:o,routeEmptyCartCTA:x,showDiscount:p,showSavings:P,...S})=>{var v,k,L;const[t,T]=A(s),a=(v=b.config)==null?void 0:v.shoppingCartDisplaySetting;H(()=>{const r=w.on("cart/data",y=>{T(y)},{eager:!0});return()=>{r==null||r.off()}},[]);const g=D({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),C=(r,y)=>B([{uid:r,quantity:y}]),M=r=>C(r,0),c=t==null?void 0:t.hasOutOfStockItems,Q=R(()=>{t&&!c&&O(t,b.locale)},[t,c]),E=i(_,{name:"ProductList",slot:e==null?void 0:e.ProductList,context:{itemQuantityUpdateHandler:C,itemRemoveHandler:M,totalQuantity:t==null?void 0:t.totalQuantity},children:i(V,{"data-testid":"default-cart-summary-list",routeProduct:d,routeEmptyCartCTA:x,initialData:t,maxItems:(k=b.config)==null?void 0:k.miniCartMaxItemsDisplay,showMaxItems:!!((L=b.config)!=null&&L.miniCartMaxItemsDisplay),hideHeading:!(t!=null&&t.totalQuantity),hideFooter:l,enableRemoveItem:!0,showDiscount:p,showSavings:P,slots:{Thumbnail:e==null?void 0:e.Thumbnail}})}),U=r=>i(_,{name:"ProductListFooter",slot:e==null?void 0:e.ProductListFooter,context:{data:r}}),F=r=>i(_,{name:"PreCheckoutSection",slot:e==null?void 0:e.PreCheckoutSection,context:{data:r}}),G=()=>(a==null?void 0:a.subtotal)==="INCLUDING_TAX"||(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:t==null?void 0:t.subtotal.includingTax.value,currency:t==null?void 0:t.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return i($,{...S,productListFooter:U(t),subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&i(N,{...G()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?i(N,{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,preCheckoutSection:F(t),ctas:t!=null&&t.totalQuantity?m("div",{children:[o&&i(I,{"data-testid":"route-checkout-button",variant:"primary",href:c?void 0:o(),disabled:c,"aria-disabled":c,onClick:Q,children:g.checkoutLink}),n&&i(I,{"data-testid":"route-cart-button",variant:"tertiary",href:n(),children:g.cartLink})]}):void 0,products:E})};q.getInitialData=async function(){return j()};export{q as MiniCart,q as default};
3
+ import{jsx as i,jsxs as s,Fragment as R}from"@dropins/tools/preact-jsx-runtime.js";import{useState as j,useEffect as w,useCallback as O}from"@dropins/tools/preact-compat.js";import{classes as h,VComponent as u,Slot as y}from"@dropins/tools/lib.js";import{g as B}from"../chunks/persisted-data.js";import{events as V}from"@dropins/tools/event-bus.js";import{Button as L,Price as N}from"@dropins/tools/components.js";/* empty css */import{useText as D}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import{s as b}from"../chunks/resetCart.js";import{p as $}from"../chunks/acdl.js";import{u as q}from"../chunks/updateProductsFromCart.js";import"../chunks/CartSummaryGrid.js";import{C as z}from"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/EmptyCart.js";import"../chunks/ChevronDown.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronUp.js";import"../chunks/Coupon.js";import"../chunks/GiftCard.js";const J=({className:_,products:m,productListFooter:l,subtotal:e,subtotalExcludingTaxes:d,preCheckoutSection:n,ctas:o,...x})=>{const p=D({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return i("div",{...x,className:h(["cart-mini-cart",_]),children:m&&s(R,{children:[i("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:m}),l&&i("div",{className:h(["cart-mini-cart__productListFooter"]),"data-testid":"mini-cart-product-list-footer",children:i(u,{node:l})}),s("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[e&&s("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[p.subtotal,i(u,{node:e})]}),d&&s("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[p.subtotalExcludingTaxes,i(u,{node:d,className:h(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),n&&i("div",{className:h(["cart-mini-cart__preCheckoutSection"]),"data-testid":"mini-cart-pre-checkout-section",children:i(u,{node:n})}),o&&i(u,{node:o,className:"cart-mini-cart__footer__ctas"})]})]})})},K=({children:_,initialData:m=null,hideFooter:l=!0,slots:e,routeProduct:d,routeCart:n,routeCheckout:o,routeEmptyCartCTA:x,showDiscount:p,showSavings:P,enableItemRemoval:S=!0,enableQuantityUpdate:T=!1,hideHeading:M=!1,...Q})=>{var v,k,I;const[t,U]=j(m),a=(v=b.config)==null?void 0:v.shoppingCartDisplaySetting;w(()=>{const r=V.on("cart/data",f=>{U(f)},{eager:!0});return()=>{r==null||r.off()}},[]);const g=D({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),C=(r,f)=>q([{uid:r,quantity:f}]),E=r=>C(r,0),c=t==null?void 0:t.hasOutOfStockItems,F=O(()=>{t&&!c&&$(t,b.locale)},[t,c]),G=i(y,{name:"ProductList",slot:e==null?void 0:e.ProductList,context:{itemQuantityUpdateHandler:C,itemRemoveHandler:E,totalQuantity:t==null?void 0:t.totalQuantity},children:i(z,{"data-testid":"default-cart-summary-list",routeProduct:d,routeEmptyCartCTA:x,initialData:t,maxItems:(k=b.config)==null?void 0:k.miniCartMaxItemsDisplay,showMaxItems:!!((I=b.config)!=null&&I.miniCartMaxItemsDisplay),hideHeading:M||!(t!=null&&t.totalQuantity),hideFooter:l,enableRemoveItem:S,enableUpdateItemQuantity:T,showDiscount:p,showSavings:P,slots:{Thumbnail:e==null?void 0:e.Thumbnail}})}),X=r=>i(y,{name:"ProductListFooter",slot:e==null?void 0:e.ProductListFooter,context:{data:r}}),A=r=>i(y,{name:"PreCheckoutSection",slot:e==null?void 0:e.PreCheckoutSection,context:{data:r}}),H=()=>(a==null?void 0:a.subtotal)==="INCLUDING_TAX"||(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:t==null?void 0:t.subtotal.includingTax.value,currency:t==null?void 0:t.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return i(J,{...Q,productListFooter:X(t),subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&i(N,{...H()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?i(N,{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,preCheckoutSection:A(t),ctas:t!=null&&t.totalQuantity?s("div",{children:[o&&i(L,{"data-testid":"route-checkout-button",variant:"primary",href:c?void 0:o(),disabled:c,"aria-disabled":c,onClick:F,children:g.checkoutLink}),n&&i(L,{"data-testid":"route-cart-button",variant:"tertiary",href:n(),children:g.cartLink})]}):void 0,products:G})};K.getInitialData=async function(){return B()};export{K as MiniCart,K as default};
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-cart", "version": "1.2.3-alpha1", "@dropins/tools": "1.0.0-alpha04071347", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-cart", "version": "1.2.3-alpha3", "@dropins/tools": "1.1.0-alpha9", "license": "SEE LICENSE IN LICENSE.md"}