@dropins/storefront-cart 0.4.0-alpha128 → 0.4.0-alpha129

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,4 +1,4 @@
1
- import{s}from"./state.js";function R(r){var n,u,e,l,c,t,a;return r?{id:r.id,totalQuantity:z(r),errors:S(r==null?void 0:r.itemsV2),items:h(r==null?void 0:r.itemsV2),miniCartMaxItems:h(r==null?void 0:r.itemsV2).slice(0,((n=s.config)==null?void 0:n.miniCartMaxItemsDisplay)??10),total:{includingTax:{value:r.prices.grand_total.value,currency:r.prices.grand_total.currency},excludingTax:{value:r.prices.grand_total_excluding_tax.value,currency:r.prices.grand_total_excluding_tax.currency}},subtotal:{excludingTax:{value:(u=r.prices.subtotal_excluding_tax)==null?void 0:u.value,currency:(e=r.prices.subtotal_excluding_tax)==null?void 0:e.currency},includingTax:{value:(l=r.prices.subtotal_including_tax)==null?void 0:l.value,currency:(c=r.prices.subtotal_including_tax)==null?void 0:c.currency},includingDiscountOnly:{value:(t=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:t.value,currency:(a=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:a.currency}},appliedTaxes:I(r.prices.applied_taxes),totalTax:k(r.prices.applied_taxes),appliedDiscounts:I(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&N(r)},isGuestCart:!s.authenticated,hasOutOfStockItems:$(r),hasFullyOutOfStockItems:P(r)}:null}function k(r){return r!=null&&r.length?r.reduce((n,u)=>({value:n.value+u.amount.value,currency:u.amount.currency}),{value:0,currency:""}):null}function h(r){var u;if(!((u=r==null?void 0:r.items)!=null&&u.length))return[];const n=s.config;return r.items.map(e=>{var l,c,t,a,_,o,i,g,y,m,f,b,d,v,C,x;return{itemType:e.__typename,uid:e.uid,url:{urlKey:e.product.url_key,categories:e.product.categories.map(O=>O.url_key)},quantity:e.quantity,sku:e.product.sku,name:e.product.name,image:{src:n!=null&&n.useConfigurableParentThumbnail?e.product.thumbnail.url:((c=(l=e.configured_variant)==null?void 0:l.thumbnail)==null?void 0:c.url)||e.product.thumbnail.url,alt:n!=null&&n.useConfigurableParentThumbnail?e.product.thumbnail.label:((a=(t=e.configured_variant)==null?void 0:t.thumbnail)==null?void 0:a.label)||e.product.thumbnail.label},price:{value:e.prices.price.value,currency:e.prices.price.currency},taxedPrice:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency},links:G(e.links),total:e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0||e.__typename==="BundleCartItem"?{value:e.prices.row_total.value,currency:e.prices.row_total.currency}:{value:(_=e.prices.original_row_total)==null?void 0:_.value,currency:(o=e.prices.original_row_total)==null?void 0:o.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency},regularPrice:e.__typename==="ConfigurableCartItem"?{value:(g=(i=e.configured_variant)==null?void 0:i.price_range)==null?void 0:g.maximum_price.regular_price.value,currency:(m=(y=e.configured_variant)==null?void 0:y.price_range)==null?void 0:m.maximum_price.regular_price.currency}:e.__typename==="GiftCardCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0||e.__typename==="BundleCartItem"?{value:e.prices.price.value,currency:e.prices.price.currency}:{value:(f=e.product.price_range)==null?void 0:f.maximum_price.regular_price.value,currency:(b=e.product.price_range)==null?void 0:b.maximum_price.regular_price.currency},discounted:e.__typename==="BundleCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0?!1:e.__typename==="ConfigurableCartItem"?((v=(d=e.configured_variant)==null?void 0:d.price_range)==null?void 0:v.maximum_price.discount.amount_off)>0:((C=e.product.price_range)==null?void 0:C.maximum_price.discount.amount_off)>0,bundleOptions:e.__typename==="BundleCartItem"?w(e.bundle_options):null,selectedOptions:E(e.configurable_options),customizableOptions:A(e.customizable_options),sender:e.__typename==="GiftCardCartItem"?e.sender_name:null,senderEmail:e.__typename==="GiftCardCartItem"?e.sender_email:null,recipient:e.__typename==="GiftCardCartItem"?e.recipient_name:null,recipientEmail:e.__typename==="GiftCardCartItem"?e.recipient_email:null,message:e.__typename==="GiftCardCartItem"?e.message:null,discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},onlyXLeftInStock:e.__typename==="ConfigurableCartItem"?(x=e.configured_variant)==null?void 0:x.only_x_left_in_stock:e.product.only_x_left_in_stock,lowInventory:e.is_available&&e.product.only_x_left_in_stock!==null,insufficientQuantity:(e.__typename==="ConfigurableCartItem"?e.configured_variant:e.product).stock_status==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockLevel:M(e)}})}function S(r){var u;const n=(u=r==null?void 0:r.items)==null?void 0:u.reduce((e,l)=>{var c;return(c=l.errors)==null||c.forEach(t=>{e.push({uid:l.uid,text:t.message})}),e},[]);return n!=null&&n.length?n:null}function I(r){return r!=null&&r.length?r.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label})):[]}function w(r){const n=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(l=>l.label).join(", ")})),u={};return n==null||n.forEach(e=>{u[e.label]=e.value}),Object.keys(u).length>0?u:null}function E(r){const n=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),u={};return n==null||n.forEach(e=>{u[e.label]=e.value}),Object.keys(u).length>0?u:null}function A(r){const n=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(l=>({uid:l.customizable_option_value_uid,label:l.label,value:l.value}))})),u={};return n==null||n.forEach(e=>{var l;switch(e.type){case"field":case"area":case"date_time":u[e.label]=e.values[0].value;break;case"radio":case"drop_down":u[e.label]=e.values[0].label;break;case"multiple":case"checkbox":u[e.label]=e.values.reduce((o,i)=>o?`${o}, ${i.label}`:i.label,"");break;case"file":const c=new DOMParser,t=e.values[0].value,_=((l=c.parseFromString(t,"text/html").querySelector("a"))==null?void 0:l.textContent)||"";u[e.label]=_;break}}),u}function z(r){var n,u;return((n=s.config)==null?void 0:n.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((u=s.config)==null?void 0:u.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function G(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(n=>n.title).join(", ")}:null}function N(r){var n,u,e,l;return(n=r.shipping_addresses)!=null&&n.length?(u=r.shipping_addresses)==null?void 0:u.map(c=>({countryCode:c.country.code,zipCode:c.postcode,regionCode:c.region.code})):(e=r.addresses)!=null&&e.length?(l=r.addresses)==null?void 0:l.filter(c=>c.default_shipping).map(c=>{var t;return c.default_shipping&&{countryCode:c.country_id,zipCode:c.postcode,regionCode:(t=c.region)==null?void 0:t.region_code}}):null}function $(r){var n,u;return(u=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:u.some(e=>{var l;return((l=e==null?void 0:e.product)==null?void 0:l.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function M(r){if(!r.not_available_message)return null;const n=r.not_available_message.match(/-?\d+/);return n?parseInt(n[0]):"noNumber"}function P(r){var n,u;return(u=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:u.some(e=>{var l;return((l=e==null?void 0:e.product)==null?void 0:l.stock_status)==="OUT_OF_STOCK"})}const p=`
1
+ import{s}from"./state.js";function R(r){var n,u,e,l,c,t,a;return r?{id:r.id,totalQuantity:z(r),errors:S(r==null?void 0:r.itemsV2),items:h(r==null?void 0:r.itemsV2),miniCartMaxItems:h(r==null?void 0:r.itemsV2).slice(0,((n=s.config)==null?void 0:n.miniCartMaxItemsDisplay)??10),total:{includingTax:{value:r.prices.grand_total.value,currency:r.prices.grand_total.currency},excludingTax:{value:r.prices.grand_total_excluding_tax.value,currency:r.prices.grand_total_excluding_tax.currency}},subtotal:{excludingTax:{value:(u=r.prices.subtotal_excluding_tax)==null?void 0:u.value,currency:(e=r.prices.subtotal_excluding_tax)==null?void 0:e.currency},includingTax:{value:(l=r.prices.subtotal_including_tax)==null?void 0:l.value,currency:(c=r.prices.subtotal_including_tax)==null?void 0:c.currency},includingDiscountOnly:{value:(t=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:t.value,currency:(a=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:a.currency}},appliedTaxes:I(r.prices.applied_taxes),totalTax:k(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:I(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&N(r)},isGuestCart:!s.authenticated,hasOutOfStockItems:$(r),hasFullyOutOfStockItems:P(r)}:null}function k(r,n){return r!=null&&r.length?r.reduce((u,e)=>({value:u.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:n}):{value:0,currency:n}}function h(r){var u;if(!((u=r==null?void 0:r.items)!=null&&u.length))return[];const n=s.config;return r.items.map(e=>{var l,c,t,a,_,o,i,g,y,m,f,b,d,v,C,x;return{itemType:e.__typename,uid:e.uid,url:{urlKey:e.product.url_key,categories:e.product.categories.map(O=>O.url_key)},quantity:e.quantity,sku:e.product.sku,name:e.product.name,image:{src:n!=null&&n.useConfigurableParentThumbnail?e.product.thumbnail.url:((c=(l=e.configured_variant)==null?void 0:l.thumbnail)==null?void 0:c.url)||e.product.thumbnail.url,alt:n!=null&&n.useConfigurableParentThumbnail?e.product.thumbnail.label:((a=(t=e.configured_variant)==null?void 0:t.thumbnail)==null?void 0:a.label)||e.product.thumbnail.label},price:{value:e.prices.price.value,currency:e.prices.price.currency},taxedPrice:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency},links:G(e.links),total:e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0||e.__typename==="BundleCartItem"?{value:e.prices.row_total.value,currency:e.prices.row_total.currency}:{value:(_=e.prices.original_row_total)==null?void 0:_.value,currency:(o=e.prices.original_row_total)==null?void 0:o.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency},regularPrice:e.__typename==="ConfigurableCartItem"?{value:(g=(i=e.configured_variant)==null?void 0:i.price_range)==null?void 0:g.maximum_price.regular_price.value,currency:(m=(y=e.configured_variant)==null?void 0:y.price_range)==null?void 0:m.maximum_price.regular_price.currency}:e.__typename==="GiftCardCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0||e.__typename==="BundleCartItem"?{value:e.prices.price.value,currency:e.prices.price.currency}:{value:(f=e.product.price_range)==null?void 0:f.maximum_price.regular_price.value,currency:(b=e.product.price_range)==null?void 0:b.maximum_price.regular_price.currency},discounted:e.__typename==="BundleCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0?!1:e.__typename==="ConfigurableCartItem"?((v=(d=e.configured_variant)==null?void 0:d.price_range)==null?void 0:v.maximum_price.discount.amount_off)>0:((C=e.product.price_range)==null?void 0:C.maximum_price.discount.amount_off)>0,bundleOptions:e.__typename==="BundleCartItem"?w(e.bundle_options):null,selectedOptions:E(e.configurable_options),customizableOptions:A(e.customizable_options),sender:e.__typename==="GiftCardCartItem"?e.sender_name:null,senderEmail:e.__typename==="GiftCardCartItem"?e.sender_email:null,recipient:e.__typename==="GiftCardCartItem"?e.recipient_name:null,recipientEmail:e.__typename==="GiftCardCartItem"?e.recipient_email:null,message:e.__typename==="GiftCardCartItem"?e.message:null,discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},onlyXLeftInStock:e.__typename==="ConfigurableCartItem"?(x=e.configured_variant)==null?void 0:x.only_x_left_in_stock:e.product.only_x_left_in_stock,lowInventory:e.is_available&&e.product.only_x_left_in_stock!==null,insufficientQuantity:(e.__typename==="ConfigurableCartItem"?e.configured_variant:e.product).stock_status==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockLevel:M(e)}})}function S(r){var u;const n=(u=r==null?void 0:r.items)==null?void 0:u.reduce((e,l)=>{var c;return(c=l.errors)==null||c.forEach(t=>{e.push({uid:l.uid,text:t.message})}),e},[]);return n!=null&&n.length?n:null}function I(r){return r!=null&&r.length?r.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label})):[]}function w(r){const n=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(l=>l.label).join(", ")})),u={};return n==null||n.forEach(e=>{u[e.label]=e.value}),Object.keys(u).length>0?u:null}function E(r){const n=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),u={};return n==null||n.forEach(e=>{u[e.label]=e.value}),Object.keys(u).length>0?u:null}function A(r){const n=r==null?void 0:r.map(e=>({uid:e.customizable_option_uid,label:e.label,type:e.type,values:e.values.map(l=>({uid:l.customizable_option_value_uid,label:l.label,value:l.value}))})),u={};return n==null||n.forEach(e=>{var l;switch(e.type){case"field":case"area":case"date_time":u[e.label]=e.values[0].value;break;case"radio":case"drop_down":u[e.label]=e.values[0].label;break;case"multiple":case"checkbox":u[e.label]=e.values.reduce((o,i)=>o?`${o}, ${i.label}`:i.label,"");break;case"file":const c=new DOMParser,t=e.values[0].value,_=((l=c.parseFromString(t,"text/html").querySelector("a"))==null?void 0:l.textContent)||"";u[e.label]=_;break}}),u}function z(r){var n,u;return((n=s.config)==null?void 0:n.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((u=s.config)==null?void 0:u.cartSummaryDisplayTotal)===1?r.total_quantity:r.itemsV2.items.length}function G(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(n=>n.title).join(", ")}:null}function N(r){var n,u,e,l;return(n=r.shipping_addresses)!=null&&n.length?(u=r.shipping_addresses)==null?void 0:u.map(c=>({countryCode:c.country.code,zipCode:c.postcode,regionCode:c.region.code})):(e=r.addresses)!=null&&e.length?(l=r.addresses)==null?void 0:l.filter(c=>c.default_shipping).map(c=>{var t;return c.default_shipping&&{countryCode:c.country_id,zipCode:c.postcode,regionCode:(t=c.region)==null?void 0:t.region_code}}):null}function $(r){var n,u;return(u=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:u.some(e=>{var l;return((l=e==null?void 0:e.product)==null?void 0:l.stock_status)==="OUT_OF_STOCK"||e.product.stock_status==="IN_STOCK"&&!e.is_available})}function M(r){if(!r.not_available_message)return null;const n=r.not_available_message.match(/-?\d+/);return n?parseInt(n[0]):"noNumber"}function P(r){var n,u;return(u=(n=r==null?void 0:r.itemsV2)==null?void 0:n.items)==null?void 0:u.some(e=>{var l;return((l=e==null?void 0:e.product)==null?void 0:l.stock_status)==="OUT_OF_STOCK"})}const p=`
2
2
  customizable_options {
3
3
  type
4
4
  customizable_option_uid
@@ -1 +1 @@
1
- import{jsxs as d,jsx as t,Fragment as rr}from"@dropins/tools/preact-jsx-runtime.js";import*as Z from"@dropins/tools/preact-compat.js";import{useState as q,useEffect as K}from"@dropins/tools/preact-compat.js";import{classes as o,VComponent as h,Slot as er}from"@dropins/tools/lib.js";import{events as Y}from"@dropins/tools/event-bus.js";import{s as tr,g as ar}from"./state.js";import{g as ir}from"./getEstimatedTotals.js";import{Accordion as cr,AccordionSection as nr,ProgressSpinner as ur,Divider as mr,Price as l,Button as sr}from"@dropins/tools/components.js";/* empty css */import{useText as M}from"@dropins/tools/i18n.js";const or=()=>{const[_,O]=q(!1),[T,x]=q();return{handleEstimateTotals:(r,p)=>{O(!0);const{shippingCountry:g,shippingState:e="",shippingStateId:C,shippingZip:y=""}=r,a={countryCode:g,postcode:y,region:{region:e,id:C},shipping_method:{carrier_code:(p==null?void 0:p.carrier_code)||"",method_code:(p==null?void 0:p.method_code)||""}};ir(a).then(c=>{var B,v,m,P,N,w,I,k,E,L,s,W,G,z,F,U,n,i,D,f;c&&x({estimatedTaxTotal:{amount:(B=c.totalTax)==null?void 0:B.value,currency:(v=c.totalTax)==null?void 0:v.currency},estimatedSubTotal:{excludingTax:{amount:(P=(m=c.subtotal)==null?void 0:m.excludingTax)==null?void 0:P.value,currency:(w=(N=c.subtotal)==null?void 0:N.excludingTax)==null?void 0:w.currency},includingTax:{amount:(k=(I=c.subtotal)==null?void 0:I.includingTax)==null?void 0:k.value,currency:(L=(E=c.subtotal)==null?void 0:E.includingTax)==null?void 0:L.currency},includingDiscountOnly:{amount:(W=(s=c.subtotal)==null?void 0:s.includingDiscountOnly)==null?void 0:W.value,currency:(z=(G=c.subtotal)==null?void 0:G.includingDiscountOnly)==null?void 0:z.currency}},estimatedGrandTotalPrice:{includingTax:{amount:(F=c.total)==null?void 0:F.includingTax.value,currency:(U=c.total)==null?void 0:U.includingTax.currency},excludingTax:{amount:(n=c.total)==null?void 0:n.excludingTax.value,currency:(i=c.total)==null?void 0:i.excludingTax.currency}},estimatedAppliedTaxes:{taxes:(D=c.appliedTaxes)==null?void 0:D.map(u=>{var b,S;return{label:u.label,amount:{value:(b=u.amount)==null?void 0:b.value,currency:(S=u.amount)==null?void 0:S.currency}}})},estimatedItems:{items:(f=c.items)==null?void 0:f.map(u=>{var b,S,V,X,j,$,Q,R,H,J;return{uid:u.uid,price:{amount:(b=u.price)==null?void 0:b.value,currency:(S=u.price)==null?void 0:S.currency},taxedPrice:{amount:(V=u.taxedPrice)==null?void 0:V.value,currency:(X=u.taxedPrice)==null?void 0:X.currency},rowTotal:{amount:(j=u.rowTotal)==null?void 0:j.value,currency:($=u.rowTotal)==null?void 0:$.currency},rowTotalIncludingTax:{amount:(Q=u.rowTotalIncludingTax)==null?void 0:Q.value,currency:(R=u.rowTotalIncludingTax)==null?void 0:R.currency},regularPrice:{amount:(H=u.regularPrice)==null?void 0:H.value,currency:(J=u.regularPrice)==null?void 0:J.currency}}})}})}).finally(()=>{O(!1)})},estimatedTotals:T,setEstimatedTotals:x,loading:_}},lr=_=>Z.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",..._},Z.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),dr=_=>Z.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",..._},Z.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),pr=({className:_,children:O,variant:T="primary",heading:x,loading:A=!0,subTotal:r,shipping:p,discounts:g,taxTotal:e,taxesApplied:C,total:y,primaryAction:a,...c})=>{const[B,v]=q(!1),m=M({checkout:"Cart.PriceSummary.checkout",discountedPrice:"Cart.CartItem.discountedPrice",download:"Cart.CartItem.download",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",regularPrice:"Cart.CartItem.regularPrice",recipient:"Cart.CartItem.recipient",sender:"Cart.CartItem.sender",file:"Cart.CartItem.file",files:"Cart.CartItem.files",orderSummary:"Cart.PriceSummary.orderSummary",taxesBreakdownTitle:"Cart.PriceSummary.taxes.breakdown",taxTotal:"Cart.PriceSummary.taxes.total",taxEstimated:"Cart.PriceSummary.taxes.estimated",taxTotalOnly:"Cart.PriceSummary.taxes.totalOnly",showTaxBreakdown:"Cart.PriceSummary.taxes.showBreakdown",hideTaxBreakdown:"Cart.PriceSummary.taxes.hideBreakdown",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",subtotalLabel:"Cart.PriceSummary.subTotal.label",subtotalWithTaxes:"Cart.PriceSummary.subTotal.withTaxes",subtotalWithoutTaxes:"Cart.PriceSummary.subTotal.withoutTaxes",totalEstimated:"Cart.PriceSummary.total.estimated",totalLabel:"Cart.PriceSummary.total.label",totalWithoutTax:"Cart.PriceSummary.total.withoutTax",shippingLabel:"Cart.PriceSummary.shipping.label",zipPlaceholder:"Cart.PriceSummary.shipping.zipPlaceholder",editZipAction:"Cart.PriceSummary.shipping.editZipAction",shippingWithTaxes:"Cart.PriceSummary.shipping.withTaxes",shippingWithoutTaxes:"Cart.PriceSummary.shipping.withoutTaxes",shippingEstimated:"Cart.PriceSummary.shipping.estimated",shippingEstimatedByState:"Cart.PriceSummary.shipping.alternateField.state",shippingEstimatedByZip:"Cart.PriceSummary.shipping.alternateField.zip",destinationLinkAriaLabel:"Cart.PriceSummary.shipping.destinationLinkAriaLabel",applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"}),P=r&&d("div",{className:o(["cart-order-summary__entry","cart-order-summary__subTotal"]),children:[t("span",{className:"cart-order-summary__label",children:m.subtotalLabel}),t(h,{node:r.price,className:"cart-order-summary__price"}),r.taxIncluded&&t("div",{"data-testid":"sub-total-tax-caption",className:"cart-order-summary__caption",children:t("span",{children:m.subtotalWithTaxes})}),r.taxExcluded?t("div",{"data-testid":"sub-total-tax-caption-excluded",className:"cart-order-summary__caption",children:d("span",{children:[r.priceExcludingTax," ",m.subtotalWithoutTaxes]})}):void 0]}),N=p&&t(h,{node:p,className:"cart-order-summary__shipping"}),w=g&&g.length>0&&t(rr,{children:g.map(s=>d("div",{className:o(["cart-order-summary__entry","cart-order-summary__discount"]),children:[t("span",{className:"cart-order-summary__label",children:s.label}),t(h,{node:s.price,className:"cart-order-summary__price"}),s.caption&&t(h,{node:s.caption,className:"cart-order-summary__caption"})]},s.label))}),I=C&&C.length>0?t(cr,{"data-testid":"tax-breakdown",className:"cart-order-summary__taxes",iconOpen:lr,iconClose:dr,children:d(nr,{title:m.taxesBreakdownTitle,secondaryText:!B&&e?t(h,{node:e.price,className:"cart-order-summary__price"}):void 0,renderContentWhenClosed:!1,onStateChange:v,children:[t("div",{className:"cart-order-summary__appliedTaxes",children:C.map(s=>d("div",{className:o(["cart-order-summary__entry","cart-order-summary__taxEntry"]),children:[t("span",{className:o(["cart-order-summary__label","cart-order-summary__label--muted"]),children:s.label}),t(h,{node:s.price,className:o(["cart-order-summary__price","cart-order-summary__price--muted"])})]},s.label))}),d("div",{className:o(["cart-order-summary__entry","cart-order-summary__taxTotal"]),children:[t("span",{className:"cart-order-summary__label",children:m.taxTotal}),e&&t(h,{node:e.price,className:"cart-order-summary__price"})]})]})}):e&&d("div",{"data-testid":"tax-total-only",className:o(["cart-order-summary__entry","cart-order-summary__taxTotal"]),children:[t("span",{className:"cart-order-summary__label",children:e.estimated?m.taxEstimated:m.taxTotalOnly}),t(h,{node:e.price,className:"cart-order-summary__price"})]}),k=y&&d("div",{"data-testid":"total-content",className:o(["cart-order-summary__entry","cart-order-summary__total",y.estimated&&"cart-order-summary__total--padded"]),children:[t("span",{className:o(["cart-order-summary__label","cart-order-summary__label--bold"]),children:y.estimated?m.totalEstimated:m.totalLabel}),t(h,{node:y.price,className:o(["cart-order-summary__price","cart-order-summary__price--bold"])})]}),E=y&&y.priceWithoutTax&&d("div",{"data-testid":"total-without-tax",className:o(["cart-order-summary__entry","cart-order-summary__totalWithoutTax"]),children:[t("span",{className:o(["cart-order-summary__label","cart-order-summary__label--muted"]),children:m.totalWithoutTax}),t(h,{node:y.priceWithoutTax,className:o(["cart-order-summary__price","cart-order-summary__price--muted"])})]}),L=a&&t("div",{className:o(["cart-order-summary__entry","cart-order-summary__primaryAction"]),children:a});return d("div",{...c,className:o(["cart-order-summary",["cart-order-summary--loading",A],[`cart-order-summary__${T}`,T],_]),children:[A&&t(ur,{className:"cart-order-summary__spinner"}),d("div",{className:"cart-order-summary__heading",children:[x&&t(h,{node:x,className:"cart-order-summary__heading-text"}),t(mr,{variant:"primary",className:"cart-order-summary__divider-primary"})]}),d("div",{className:"cart-order-summary__content",children:[P,N,w,I,k,E,L]})]})},yr=({children:_,initialData:O=null,routeCheckout:T,slots:x,...A})=>{var v,m,P,N,w,I,k,E,L,s,W,G,z,F,U;const[r,p]=q(O),{handleEstimateTotals:g,estimatedTotals:e,setEstimatedTotals:C,loading:y}=or(),a=(v=tr.config)==null?void 0:v.shoppingCartDisplaySetting;K(()=>{const n=Y.on("cart/data",i=>{var u;p(i);const D=(u=i==null?void 0:i.addresses)==null?void 0:u.shipping,f=i==null?void 0:i.isVirtual;(D||f)&&C(null)},{eager:!0});return()=>{n==null||n.off()}},[]),K(()=>{const n=Y.on("shipping/estimate",i=>{var u,b,S,V,X,j;const D={shippingCountry:(u=i==null?void 0:i.address)==null?void 0:u.countryCode,shippingState:(b=i==null?void 0:i.address)==null?void 0:b.region,shippingStateId:(S=i==null?void 0:i.address)==null?void 0:S.regionId,shippingZip:(V=i==null?void 0:i.address)==null?void 0:V.postCode},f={carrier_code:((X=i==null?void 0:i.shippingMethod)==null?void 0:X.carrierCode)||"",method_code:((j=i==null?void 0:i.shippingMethod)==null?void 0:j.methodCode)||""};g(D,f)});return()=>{n==null||n.off()}},[g]);const c=M({checkout:"Cart.PriceSummary.checkout",orderSummary:"Cart.PriceSummary.orderSummary",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined"}),B=!(r!=null&&r.isVirtual)&&(x!=null&&x.EstimateShipping)?t(er,{name:"EstimateShipping",slot:x.EstimateShipping},"estimateShippingId"):void 0;return!Object.keys(r??{}).length||(r==null?void 0:r.totalQuantity)===0?null:t(pr,{...A,"data-testid":"cart-order-summary",heading:t("div",{children:c.orderSummary}),shipping:B,loading:y,subTotal:{taxIncluded:(a==null?void 0:a.subtotal)==="INCLUDING_TAX"&&!(a!=null&&a.zeroTax),taxExcluded:(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX",zeroTaxSubtotal:a==null?void 0:a.zeroTax,priceExcludingTax:(m=e==null?void 0:e.estimatedSubTotal)!=null&&m.excludingTax?t(l,{"data-testid":"subtotal",...(P=e==null?void 0:e.estimatedSubTotal)==null?void 0:P.excludingTax}):t(l,{"data-testid":"subtotal",amount:(N=r==null?void 0:r.subtotal.excludingTax)==null?void 0:N.value,currency:(w=r==null?void 0:r.subtotal.excludingTax)==null?void 0:w.currency}),price:!(a!=null&&a.zeroTax)&&(a==null?void 0:a.subtotal)==="INCLUDING_TAX"||!(a!=null&&a.zeroTax)&&(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?(I=e==null?void 0:e.estimatedSubTotal)!=null&&I.includingTax?t(l,{"data-testid":"subtotal",...(k=e==null?void 0:e.estimatedSubTotal)==null?void 0:k.includingTax}):t(l,{"data-testid":"subtotal",amount:(E=r==null?void 0:r.subtotal.includingTax)==null?void 0:E.value,currency:(L=r==null?void 0:r.subtotal.includingTax)==null?void 0:L.currency}):t(l,{"data-testid":"subtotal",amount:(s=r==null?void 0:r.subtotal.excludingTax)==null?void 0:s.value,currency:(W=r==null?void 0:r.subtotal.excludingTax)==null?void 0:W.currency})},discounts:r==null?void 0:r.appliedDiscounts.map(n=>({label:n.label,price:t(l,{"data-testid":"summary-discount-total",amount:-n.amount.value,currency:n.amount.currency,sale:!0})})),taxTotal:r!=null&&r.isVirtual?{price:t("span",{"data-testid":"tax-total",children:c.taxToBeDetermined})}:{price:e!=null&&e.estimatedTaxTotal?t(l,{"data-testid":"tax-total",...e==null?void 0:e.estimatedTaxTotal}):r!=null&&r.totalTax?t(l,{"data-testid":"tax-total",amount:(G=r==null?void 0:r.totalTax)==null?void 0:G.value,currency:(z=r==null?void 0:r.totalTax)==null?void 0:z.currency}):t("span",{"data-testid":"tax-total",children:c.taxToBeDetermined}),estimated:!!(e!=null&&e.estimatedTaxTotal)},taxesApplied:r!=null&&r.isVirtual?void 0:a!=null&&a.fullSummary&&(e!=null&&e.estimatedAppliedTaxes)?(U=(F=e==null?void 0:e.estimatedAppliedTaxes)==null?void 0:F.taxes)==null?void 0:U.map(n=>({label:n.label,price:t(l,{"data-testid":"applied-taxes",amount:n.amount.value,currency:n.amount.currency})})):a!=null&&a.fullSummary?r==null?void 0:r.appliedTaxes.map(n=>({label:n.label,price:t(l,{"data-testid":"applied-taxes",amount:n.amount.value,currency:n.amount.currency})})):void 0,total:{price:e!=null&&e.estimatedGrandTotalPrice?t(l,{...e==null?void 0:e.estimatedGrandTotalPrice.includingTax}):t(l,{amount:r==null?void 0:r.total.includingTax.value,currency:r==null?void 0:r.total.includingTax.currency}),estimated:!!(e!=null&&e.estimatedGrandTotalPrice),priceWithoutTax:a!=null&&a.grandTotal?e!=null&&e.estimatedAppliedTaxes?t(l,{...e==null?void 0:e.estimatedGrandTotalPrice.excludingTax}):t(l,{amount:r==null?void 0:r.total.excludingTax.value,currency:r==null?void 0:r.total.excludingTax.currency}):void 0},primaryAction:T&&t(sr,{"data-testid":"checkout-button",variant:"primary",disabled:r==null?void 0:r.hasOutOfStockItems,"aria-disabled":r==null?void 0:r.hasOutOfStockItems,href:r!=null&&r.hasOutOfStockItems?void 0:T({cartId:r.id}),children:c.checkout})})};yr.getInitialData=async function(){return ar()};export{yr as O};
1
+ import{jsxs as d,jsx as t,Fragment as er}from"@dropins/tools/preact-jsx-runtime.js";import*as H from"@dropins/tools/preact-compat.js";import{useState as J,useEffect as Y}from"@dropins/tools/preact-compat.js";import{classes as o,VComponent as h,Slot as tr}from"@dropins/tools/lib.js";import{events as M}from"@dropins/tools/event-bus.js";import{s as ar,g as ir}from"./state.js";import{g as nr}from"./getEstimatedTotals.js";import{Accordion as cr,AccordionSection as sr,ProgressSpinner as mr,Divider as or,Price as u,Button as ur}from"@dropins/tools/components.js";/* empty css */import{useText as rr}from"@dropins/tools/i18n.js";const lr=()=>{const[_,O]=J(!1),[C,x]=J();return{handleEstimateTotals:(r,p)=>{O(!0);const{shippingCountry:g,shippingState:l="",shippingStateId:e,shippingZip:y=""}=r,E={countryCode:g,postcode:y,region:{region:l,id:e},shipping_method:{carrier_code:(p==null?void 0:p.carrier_code)||"",method_code:(p==null?void 0:p.method_code)||""}};nr(E).then(a=>{var v,P,c,T,B,w,N,f,I,k,m,A,F,z,G,V,Z,j,U,X;a&&x({estimatedTaxTotal:{amount:(v=a.totalTax)==null?void 0:v.value,currency:(P=a.totalTax)==null?void 0:P.currency},estimatedSubTotal:{excludingTax:{amount:(T=(c=a.subtotal)==null?void 0:c.excludingTax)==null?void 0:T.value,currency:(w=(B=a.subtotal)==null?void 0:B.excludingTax)==null?void 0:w.currency},includingTax:{amount:(f=(N=a.subtotal)==null?void 0:N.includingTax)==null?void 0:f.value,currency:(k=(I=a.subtotal)==null?void 0:I.includingTax)==null?void 0:k.currency},includingDiscountOnly:{amount:(A=(m=a.subtotal)==null?void 0:m.includingDiscountOnly)==null?void 0:A.value,currency:(z=(F=a.subtotal)==null?void 0:F.includingDiscountOnly)==null?void 0:z.currency}},estimatedGrandTotalPrice:{includingTax:{amount:(G=a.total)==null?void 0:G.includingTax.value,currency:(V=a.total)==null?void 0:V.includingTax.currency},excludingTax:{amount:(Z=a.total)==null?void 0:Z.excludingTax.value,currency:(j=a.total)==null?void 0:j.excludingTax.currency}},estimatedAppliedTaxes:{taxes:(U=a.appliedTaxes)==null?void 0:U.map(s=>{var b,n;return{label:s.label,amount:{value:(b=s.amount)==null?void 0:b.value,currency:(n=s.amount)==null?void 0:n.currency}}})},estimatedItems:{items:(X=a.items)==null?void 0:X.map(s=>{var b,n,i,L,D,S,q,$,Q,R;return{uid:s.uid,price:{amount:(b=s.price)==null?void 0:b.value,currency:(n=s.price)==null?void 0:n.currency},taxedPrice:{amount:(i=s.taxedPrice)==null?void 0:i.value,currency:(L=s.taxedPrice)==null?void 0:L.currency},rowTotal:{amount:(D=s.rowTotal)==null?void 0:D.value,currency:(S=s.rowTotal)==null?void 0:S.currency},rowTotalIncludingTax:{amount:(q=s.rowTotalIncludingTax)==null?void 0:q.value,currency:($=s.rowTotalIncludingTax)==null?void 0:$.currency},regularPrice:{amount:(Q=s.regularPrice)==null?void 0:Q.value,currency:(R=s.regularPrice)==null?void 0:R.currency}}})}})}).finally(()=>{O(!1)})},estimatedTotals:C,setEstimatedTotals:x,loading:_}},dr=_=>H.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",..._},H.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),pr=_=>H.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",..._},H.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),yr=({className:_,children:O,variant:C="primary",heading:x,loading:W=!0,subTotal:r,shipping:p,discounts:g,taxTotal:l,taxesApplied:e,total:y,primaryAction:E,...a})=>{const[v,P]=J(!1),c=rr({checkout:"Cart.PriceSummary.checkout",discountedPrice:"Cart.CartItem.discountedPrice",download:"Cart.CartItem.download",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",regularPrice:"Cart.CartItem.regularPrice",recipient:"Cart.CartItem.recipient",sender:"Cart.CartItem.sender",file:"Cart.CartItem.file",files:"Cart.CartItem.files",orderSummary:"Cart.PriceSummary.orderSummary",taxesBreakdownTitle:"Cart.PriceSummary.taxes.breakdown",taxTotal:"Cart.PriceSummary.taxes.total",taxEstimated:"Cart.PriceSummary.taxes.estimated",taxTotalOnly:"Cart.PriceSummary.taxes.totalOnly",showTaxBreakdown:"Cart.PriceSummary.taxes.showBreakdown",hideTaxBreakdown:"Cart.PriceSummary.taxes.hideBreakdown",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",subtotalLabel:"Cart.PriceSummary.subTotal.label",subtotalWithTaxes:"Cart.PriceSummary.subTotal.withTaxes",subtotalWithoutTaxes:"Cart.PriceSummary.subTotal.withoutTaxes",totalEstimated:"Cart.PriceSummary.total.estimated",totalLabel:"Cart.PriceSummary.total.label",totalWithoutTax:"Cart.PriceSummary.total.withoutTax",shippingLabel:"Cart.PriceSummary.shipping.label",zipPlaceholder:"Cart.PriceSummary.shipping.zipPlaceholder",editZipAction:"Cart.PriceSummary.shipping.editZipAction",shippingWithTaxes:"Cart.PriceSummary.shipping.withTaxes",shippingWithoutTaxes:"Cart.PriceSummary.shipping.withoutTaxes",shippingEstimated:"Cart.PriceSummary.shipping.estimated",shippingEstimatedByState:"Cart.PriceSummary.shipping.alternateField.state",shippingEstimatedByZip:"Cart.PriceSummary.shipping.alternateField.zip",destinationLinkAriaLabel:"Cart.PriceSummary.shipping.destinationLinkAriaLabel",applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"}),T=r&&d("div",{className:o(["cart-order-summary__entry","cart-order-summary__subTotal"]),children:[t("span",{className:"cart-order-summary__label",children:c.subtotalLabel}),t(h,{node:r.price,className:"cart-order-summary__price"}),r.taxIncluded&&t("div",{"data-testid":"sub-total-tax-caption",className:"cart-order-summary__caption",children:t("span",{children:c.subtotalWithTaxes})}),r.taxExcluded?t("div",{"data-testid":"sub-total-tax-caption-excluded",className:"cart-order-summary__caption",children:d("span",{children:[r.priceExcludingTax," ",c.subtotalWithoutTaxes]})}):void 0]}),B=p&&t(h,{node:p,className:"cart-order-summary__shipping"}),w=g&&g.length>0&&t(er,{children:g.map(m=>d("div",{className:o(["cart-order-summary__entry","cart-order-summary__discount"]),children:[t("span",{className:"cart-order-summary__label",children:m.label}),t(h,{node:m.price,className:"cart-order-summary__price"}),m.caption&&t(h,{node:m.caption,className:"cart-order-summary__caption"})]},m.label))}),N=e&&e.length>0?t(cr,{"data-testid":"tax-breakdown",className:"cart-order-summary__taxes",iconOpen:dr,iconClose:pr,children:d(sr,{title:c.taxesBreakdownTitle,secondaryText:!v&&l?t(h,{node:l.price,className:"cart-order-summary__price"}):void 0,renderContentWhenClosed:!1,onStateChange:P,children:[t("div",{className:"cart-order-summary__appliedTaxes",children:e.map(m=>d("div",{className:o(["cart-order-summary__entry","cart-order-summary__taxEntry"]),children:[t("span",{className:o(["cart-order-summary__label","cart-order-summary__label--muted"]),children:m.label}),t(h,{node:m.price,className:o(["cart-order-summary__price","cart-order-summary__price--muted"])})]},m.label))}),d("div",{className:o(["cart-order-summary__entry","cart-order-summary__taxTotal"]),children:[t("span",{className:"cart-order-summary__label",children:c.taxTotal}),l&&t(h,{node:l.price,className:"cart-order-summary__price"})]})]})}):l&&d("div",{"data-testid":"tax-total-only",className:o(["cart-order-summary__entry","cart-order-summary__taxTotal"]),children:[t("span",{className:"cart-order-summary__label",children:l.estimated?c.taxEstimated:c.taxTotalOnly}),t(h,{node:l.price,className:"cart-order-summary__price"})]}),f=y&&d("div",{"data-testid":"total-content",className:o(["cart-order-summary__entry","cart-order-summary__total",y.estimated&&"cart-order-summary__total--padded"]),children:[t("span",{className:o(["cart-order-summary__label","cart-order-summary__label--bold"]),children:y.estimated?c.totalEstimated:c.totalLabel}),t(h,{node:y.price,className:o(["cart-order-summary__price","cart-order-summary__price--bold"])})]}),I=y&&y.priceWithoutTax&&d("div",{"data-testid":"total-without-tax",className:o(["cart-order-summary__entry","cart-order-summary__totalWithoutTax"]),children:[t("span",{className:o(["cart-order-summary__label","cart-order-summary__label--muted"]),children:c.totalWithoutTax}),t(h,{node:y.priceWithoutTax,className:o(["cart-order-summary__price","cart-order-summary__price--muted"])})]}),k=E&&t("div",{className:o(["cart-order-summary__entry","cart-order-summary__primaryAction"]),children:E});return d("div",{...a,className:o(["cart-order-summary",["cart-order-summary--loading",W],[`cart-order-summary__${C}`,C],_]),children:[W&&t(mr,{className:"cart-order-summary__spinner"}),d("div",{className:"cart-order-summary__heading",children:[x&&t(h,{node:x,className:"cart-order-summary__heading-text"}),t(or,{variant:"primary",className:"cart-order-summary__divider-primary"})]}),d("div",{className:"cart-order-summary__content",children:[T,B,w,N,f,I,k]})]})},hr=({children:_,initialData:O=null,routeCheckout:C,slots:x,...W})=>{var w,N,f,I,k,m,A,F,z,G,V,Z,j,U,X,s,b;const[r,p]=J(O),g=r==null?void 0:r.isVirtual,{handleEstimateTotals:l,estimatedTotals:e,setEstimatedTotals:y,loading:E}=lr(),a=(w=ar.config)==null?void 0:w.shoppingCartDisplaySetting,v=(a==null?void 0:a.subtotal)==="INCLUDING_TAX",P=(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX",c=a==null?void 0:a.zeroTax;Y(()=>{const n=M.on("cart/data",i=>{var S;p(i);const L=(S=i==null?void 0:i.addresses)==null?void 0:S.shipping,D=i==null?void 0:i.isVirtual;(L||D)&&y(null)},{eager:!0});return()=>{n==null||n.off()}},[]),Y(()=>{const n=M.on("shipping/estimate",i=>{var S,q,$,Q,R,K;const L={shippingCountry:(S=i==null?void 0:i.address)==null?void 0:S.countryCode,shippingState:(q=i==null?void 0:i.address)==null?void 0:q.region,shippingStateId:($=i==null?void 0:i.address)==null?void 0:$.regionId,shippingZip:(Q=i==null?void 0:i.address)==null?void 0:Q.postCode},D={carrier_code:((R=i==null?void 0:i.shippingMethod)==null?void 0:R.carrierCode)||"",method_code:((K=i==null?void 0:i.shippingMethod)==null?void 0:K.methodCode)||""};l(L,D)});return()=>{n==null||n.off()}},[l]);const T=rr({checkout:"Cart.PriceSummary.checkout",orderSummary:"Cart.PriceSummary.orderSummary",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined"}),B=!g&&(x!=null&&x.EstimateShipping)?t(tr,{name:"EstimateShipping",slot:x.EstimateShipping},"estimateShippingId"):void 0;return!Object.keys(r??{}).length||(r==null?void 0:r.totalQuantity)===0?null:t(yr,{...W,"data-testid":"cart-order-summary",heading:t("div",{children:T.orderSummary}),shipping:B,loading:E,subTotal:{taxIncluded:v&&!c,taxExcluded:P,zeroTaxSubtotal:c,priceExcludingTax:(N=e==null?void 0:e.estimatedSubTotal)!=null&&N.excludingTax?t(u,{"data-testid":"subtotal",...(f=e==null?void 0:e.estimatedSubTotal)==null?void 0:f.excludingTax}):t(u,{"data-testid":"subtotal",amount:(I=r==null?void 0:r.subtotal.excludingTax)==null?void 0:I.value,currency:(k=r==null?void 0:r.subtotal.excludingTax)==null?void 0:k.currency}),price:!c&&v||!c&&P?(m=e==null?void 0:e.estimatedSubTotal)!=null&&m.includingTax?t(u,{"data-testid":"subtotal",...(A=e==null?void 0:e.estimatedSubTotal)==null?void 0:A.includingTax}):t(u,{"data-testid":"subtotal",amount:(F=r==null?void 0:r.subtotal.includingTax)==null?void 0:F.value,currency:(z=r==null?void 0:r.subtotal.includingTax)==null?void 0:z.currency}):t(u,{"data-testid":"subtotal",amount:(G=r==null?void 0:r.subtotal.excludingTax)==null?void 0:G.value,currency:(V=r==null?void 0:r.subtotal.excludingTax)==null?void 0:V.currency})},discounts:r==null?void 0:r.appliedDiscounts.map(n=>({label:n.label,price:t(u,{"data-testid":"summary-discount-total",amount:-n.amount.value,currency:n.amount.currency,sale:!0})})),taxTotal:g?{price:t("span",{"data-testid":"tax-total",children:T.taxToBeDetermined})}:{price:e!=null&&e.estimatedTaxTotal?t(u,{"data-testid":"tax-total",...e==null?void 0:e.estimatedTaxTotal}):t(u,{"data-testid":"tax-total",amount:(Z=r==null?void 0:r.totalTax)==null?void 0:Z.value,currency:(j=r==null?void 0:r.totalTax)==null?void 0:j.currency}),estimated:(!e||!!(e!=null&&e.estimatedTaxTotal))&&!((U=r==null?void 0:r.addresses)!=null&&U.shipping)},taxesApplied:g?void 0:a!=null&&a.fullSummary?(s=((X=e==null?void 0:e.estimatedAppliedTaxes)==null?void 0:X.taxes)||(r==null?void 0:r.appliedTaxes))==null?void 0:s.map(n=>({label:n.label,price:t(u,{"data-testid":"applied-taxes",amount:n.amount.value,currency:n.amount.currency})})):void 0,total:{price:e!=null&&e.estimatedGrandTotalPrice?t(u,{...e==null?void 0:e.estimatedGrandTotalPrice.includingTax}):t(u,{amount:r==null?void 0:r.total.includingTax.value,currency:r==null?void 0:r.total.includingTax.currency}),estimated:(!e||!!(e!=null&&e.estimatedTaxTotal))&&!((b=r==null?void 0:r.addresses)!=null&&b.shipping),priceWithoutTax:a!=null&&a.grandTotal?e!=null&&e.estimatedAppliedTaxes?t(u,{...e==null?void 0:e.estimatedGrandTotalPrice.excludingTax}):t(u,{amount:r==null?void 0:r.total.excludingTax.value,currency:r==null?void 0:r.total.excludingTax.currency}):void 0},primaryAction:C&&t(ur,{"data-testid":"checkout-button",variant:"primary",disabled:r==null?void 0:r.hasOutOfStockItems,"aria-disabled":r==null?void 0:r.hasOutOfStockItems,href:r!=null&&r.hasOutOfStockItems?void 0:C({cartId:r.id}),children:T.checkout})})};hr.getInitialData=async function(){return ir()};export{hr as O};
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-cart", "version": "0.4.0-alpha128", "@dropins/tools": "~0.27.0"}
1
+ {"name": "@dropins/storefront-cart", "version": "0.4.0-alpha129", "@dropins/tools": "~0.27.0"}