@dropins/storefront-cart 1.2.3-alpha2 → 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.
|
@@ -21,6 +21,7 @@ export interface MiniCartProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
21
21
|
showSavings?: boolean;
|
|
22
22
|
enableItemRemoval?: boolean;
|
|
23
23
|
enableQuantityUpdate?: boolean;
|
|
24
|
+
hideHeading?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export declare const MiniCart: Container<MiniCartProps, CartModel | null>;
|
|
26
27
|
//# sourceMappingURL=MiniCart.d.ts.map
|
package/containers/MiniCart.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as i,jsxs as
|
|
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-
|
|
1
|
+
{"name": "@dropins/storefront-cart", "version": "1.2.3-alpha3", "@dropins/tools": "1.1.0-alpha9", "license": "SEE LICENSE IN LICENSE.md"}
|