@dropins/storefront-cart 0.7.0-alpha010 → 0.7.0-alpha015

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"./resetCart.js";function D(r){var n,u,e,l,c,t,a;return r?{id:r.id,totalQuantity:G(r),errors:w(r==null?void 0:r.itemsV2),items:T(r==null?void 0:r.itemsV2),miniCartMaxItems:T(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:O(r.prices.applied_taxes),totalTax:S(r.prices.applied_taxes,r.prices.grand_total.currency),appliedDiscounts:O(r.prices.discounts),isVirtual:r.is_virtual,addresses:{shipping:r.shipping_addresses&&$(r)},isGuestCart:!s.authenticated,hasOutOfStockItems:M(r),hasFullyOutOfStockItems:F(r)}:null}function S(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 T(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,y,m,f,b,d,v,C,x,h,I;return{itemType:e.__typename,uid:e.uid,url:{urlKey:e.product.url_key,categories:e.product.categories.map(p=>p.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:N(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,label:(i=e.prices.discounts)==null?void 0:i.map(p=>p.label)},regularPrice:e.__typename==="ConfigurableCartItem"?{value:(m=(y=e.configured_variant)==null?void 0:y.price_range)==null?void 0:m.maximum_price.regular_price.value,currency:(b=(f=e.configured_variant)==null?void 0:f.price_range)==null?void 0:b.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:(d=e.product.price_range)==null?void 0:d.maximum_price.regular_price.value,currency:(v=e.product.price_range)==null?void 0:v.maximum_price.regular_price.currency},discounted:e.__typename==="BundleCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0?!1:e.__typename==="ConfigurableCartItem"?((x=(C=e.configured_variant)==null?void 0:C.price_range)==null?void 0:x.maximum_price.discount.amount_off)>0:((h=e.product.price_range)==null?void 0:h.maximum_price.discount.amount_off)>0,bundleOptions:e.__typename==="BundleCartItem"?E(e.bundle_options):null,selectedOptions:A(e.configurable_options),customizableOptions:z(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"?(I=e.configured_variant)==null?void 0:I.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:P(e)}})}function w(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 O(r){return r!=null&&r.length?r.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label})):[]}function E(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 A(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 z(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 G(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 N(r){return(r==null?void 0:r.length)>0?{count:r.length,result:r.map(n=>n.title).join(", ")}:null}function $(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 M(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 P(r){if(!r.not_available_message)return null;const n=r.not_available_message.match(/-?\d+/);return n?parseInt(n[0]):"noNumber"}function F(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 g=`
1
+ import{s}from"./resetCart.js";function R(r){var u,n,e,l,t,c,a;return r?{id:r.id,totalQuantity:z(r),errors:k(r==null?void 0:r.itemsV2),items:h(r==null?void 0:r.itemsV2),miniCartMaxItems:h(r==null?void 0:r.itemsV2).slice(0,((u=s.config)==null?void 0:u.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:(n=r.prices.subtotal_excluding_tax)==null?void 0:n.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:(t=r.prices.subtotal_including_tax)==null?void 0:t.currency},includingDiscountOnly:{value:(c=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:c.value,currency:(a=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:a.currency}},appliedTaxes:I(r.prices.applied_taxes),totalTax:S(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:P(r),hasFullyOutOfStockItems:M(r)}:null}function S(r,u){return r!=null&&r.length?r.reduce((n,e)=>({value:n.value+e.amount.value,currency:e.amount.currency}),{value:0,currency:u}):{value:0,currency:u}}function h(r){var n;if(!((n=r==null?void 0:r.items)!=null&&n.length))return[];const u=s.config;return r.items.map(e=>{var l,t,c,a,_,o,i,g,y,f,m,d,b,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:u!=null&&u.useConfigurableParentThumbnail?e.product.thumbnail.url:((t=(l=e.configured_variant)==null?void 0:l.thumbnail)==null?void 0:t.url)||e.product.thumbnail.url,alt:u!=null&&u.useConfigurableParentThumbnail?e.product.thumbnail.label:((a=(c=e.configured_variant)==null?void 0:c.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:(f=(y=e.configured_variant)==null?void 0:y.price_range)==null?void 0:f.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:(m=e.product.price_range)==null?void 0:m.maximum_price.regular_price.value,currency:(d=e.product.price_range)==null?void 0:d.maximum_price.regular_price.currency},discounted:e.__typename==="BundleCartItem"||e.__typename==="SimpleCartItem"&&e.customizable_options.length!==0?!1:e.__typename==="ConfigurableCartItem"?((v=(b=e.configured_variant)==null?void 0:b.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:A(e.configurable_options),customizableOptions:E(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:$(e),productAttributes:V(e)}})}function k(r){var n;const u=(n=r==null?void 0:r.items)==null?void 0:n.reduce((e,l)=>{var t;return(t=l.errors)==null||t.forEach(c=>{e.push({uid:l.uid,text:c.message})}),e},[]);return u!=null&&u.length?u:null}function I(r){return r!=null&&r.length?r.map(u=>({amount:{value:u.amount.value,currency:u.amount.currency},label:u.label})):[]}function w(r){const u=r==null?void 0:r.map(e=>({uid:e.uid,label:e.label,value:e.values.map(l=>l.label).join(", ")})),n={};return u==null||u.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function A(r){const u=r==null?void 0:r.map(e=>({uid:e.configurable_product_option_uid,label:e.option_label,value:e.value_label})),n={};return u==null||u.forEach(e=>{n[e.label]=e.value}),Object.keys(n).length>0?n:null}function E(r){const u=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}))})),n={};return u==null||u.forEach(e=>{var l;switch(e.type){case"field":case"area":case"date_time":n[e.label]=e.values[0].value;break;case"radio":case"drop_down":n[e.label]=e.values[0].label;break;case"multiple":case"checkbox":n[e.label]=e.values.reduce((o,i)=>o?`${o}, ${i.label}`:i.label,"");break;case"file":const t=new DOMParser,c=e.values[0].value,_=((l=t.parseFromString(c,"text/html").querySelector("a"))==null?void 0:l.textContent)||"";n[e.label]=_;break}}),n}function z(r){var u,n;return((u=s.config)==null?void 0:u.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((n=s.config)==null?void 0:n.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(u=>u.title).join(", ")}:null}function N(r){var u,n,e,l;return(u=r.shipping_addresses)!=null&&u.length?(n=r.shipping_addresses)==null?void 0:n.map(t=>({countryCode:t.country.code,zipCode:t.postcode,regionCode:t.region.code})):(e=r.addresses)!=null&&e.length?(l=r.addresses)==null?void 0:l.filter(t=>t.default_shipping).map(t=>{var c;return t.default_shipping&&{countryCode:t.country_id,zipCode:t.postcode,regionCode:(c=t.region)==null?void 0:c.region_code}}):null}function P(r){var u,n;return(n=(u=r==null?void 0:r.itemsV2)==null?void 0:u.items)==null?void 0:n.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 $(r){if(!r.not_available_message)return null;const u=r.not_available_message.match(/-?\d+/);return u?parseInt(u[0]):"noNumber"}function M(r){var u,n;return(n=(u=r==null?void 0:r.itemsV2)==null?void 0:u.items)==null?void 0:n.some(e=>{var l;return((l=e==null?void 0:e.product)==null?void 0:l.stock_status)==="OUT_OF_STOCK"})}function V(r){var u,n,e;return(e=(n=(u=r==null?void 0:r.product)==null?void 0:u.custom_attributesV2)==null?void 0:n.items)==null?void 0:e.map(l=>{const t=l.code.split("_").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ");return{...l,code:t}})}const p=`
2
2
  customizable_options {
3
3
  type
4
4
  customizable_option_uid
@@ -14,7 +14,7 @@ import{s}from"./resetCart.js";function D(r){var n,u,e,l,c,t,a;return r?{id:r.id,
14
14
  }
15
15
  }
16
16
  }
17
- `,k=`
17
+ `,T=`
18
18
  price_range {
19
19
  minimum_price {
20
20
  regular_price {
@@ -45,7 +45,7 @@ import{s}from"./resetCart.js";function D(r){var n,u,e,l,c,t,a;return r?{id:r.id,
45
45
  }
46
46
  }
47
47
  }
48
- `,V=`
48
+ `,D=`
49
49
  fragment CartFragment on Cart {
50
50
  id
51
51
  total_quantity
@@ -107,13 +107,6 @@ fragment CartFragment on Cart {
107
107
  value
108
108
  currency
109
109
  }
110
- discounts {
111
- amount {
112
- value
113
- currency
114
- }
115
- label
116
- }
117
110
  total_item_discount {
118
111
  value
119
112
  currency
@@ -156,12 +149,27 @@ fragment CartFragment on Cart {
156
149
  url_path
157
150
  url_key
158
151
  }
152
+ custom_attributesV2(filters: {is_visible_on_front: true}){
153
+ items{
154
+ code
155
+ ...on AttributeValue{
156
+ value
157
+ }
158
+ ...on AttributeSelectedOptions{
159
+ selected_options {
160
+ value
161
+ label
162
+ }
163
+
164
+ }
165
+ }
166
+ }
159
167
  only_x_left_in_stock
160
168
  stock_status
161
- ${k}
169
+ ${T}
162
170
  }
163
171
  ...on SimpleCartItem {
164
- ${g}
172
+ ${p}
165
173
  }
166
174
  ... on ConfigurableCartItem {
167
175
  configurable_options {
@@ -178,16 +186,16 @@ fragment CartFragment on Cart {
178
186
  label
179
187
  url
180
188
  }
181
- ${k}
189
+ ${T}
182
190
  }
183
- ${g}
191
+ ${p}
184
192
  }
185
193
  ... on DownloadableCartItem {
186
194
  links {
187
195
  sort_order
188
196
  title
189
197
  }
190
- ${g}
198
+ ${p}
191
199
  }
192
200
  ... on BundleCartItem {
193
201
  bundle_options {
@@ -223,11 +231,11 @@ fragment CartFragment on Cart {
223
231
  postcode
224
232
  }
225
233
  }
226
- `,q=`
234
+ `,U=`
227
235
  $pageSize: Int! = 100,
228
236
  $currentPage: Int! = 1,
229
237
  $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}
230
- `,B=`
238
+ `,q=`
231
239
  customer {
232
240
  addresses {
233
241
  default_shipping
@@ -239,4 +247,4 @@ customer {
239
247
  region_id
240
248
  }
241
249
  }
242
- }`;export{q as C,V as a,B as b,D as t};
250
+ }`;export{U as C,D as a,q as b,R as t};
@@ -1 +1 @@
1
- import{jsx as r,jsxs as k,Fragment as Z}from"@dropins/tools/preact-jsx-runtime.js";import*as s from"@dropins/tools/preact-compat.js";import{useState as _,useEffect as T}from"@dropins/tools/preact-compat.js";import{classes as x,VComponent as V,Slot as X}from"@dropins/tools/lib.js";/* empty css */import{E as mt}from"./EmptyCart.js";import{Divider as vt,Skeleton as Lt,SkeletonRow as Ct,InLineAlert as wt,Icon as j,CartList as D,CartItem as It,Price as O,Image as Et}from"@dropins/tools/components.js";import{g as St}from"./persisted-data.js";import{events as _t}from"@dropins/tools/event-bus.js";import{s as xt}from"./resetCart.js";import{u as J}from"./updateProductsFromCart.js";import{useText as Ot}from"@dropins/tools/i18n.js";const K=g=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...g},s.createElement("g",{clipPath:"url(#clip0_4797_15331)"},s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.25 20.91L1.5 17.55V6.51996L10.25 9.92996V20.91Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19 13.31L15.5 19.37H22.5L19 13.31Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19.0202 17.11H18.9802L18.9502 15.56H19.0502L19.0202 17.11ZM18.9602 18.29V18.06H19.0502V18.29H18.9602Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19 12.16V6.51996L10.25 9.92996V20.91L14.27 19.37L14.4 19.32",stroke:"currentColor",strokeLinejoin:"round"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.51999L10.25 3.04999L19 6.51999L10.25 9.92999L1.5 6.51999Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_4797_15331"},s.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),Nt=g=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...g},s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),Pt=({className:g,children:$,heading:f,emptyCart:m,products:p,outOfStockMessage:h,loading:N=!0,...l})=>r("div",{...l,className:x(["cart-cart-summary-list",g]),children:N?r(Qt,{}):k(Z,{children:[(f||h)&&k("div",{"data-testid":"cart-summary-list-heading-wrapper",className:x(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!p]]),children:[f&&k(Z,{children:[r(V,{node:f,className:"cart-cart-summary-list__heading-text"}),r(vt,{variant:"primary",className:x(["cart-cart-summary-list__heading-divider"])})]}),h&&r(V,{node:h,className:"cart-cart-summary-list__out-of-stock-message"})]}),r("div",{className:x(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!p]]),children:p||r(V,{node:m,className:"cart-cart-summary-list__empty-cart"})})]})}),Qt=()=>r(Lt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:r(Ct,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),Gt=({initialData:g=null,hideHeading:$,routeProduct:f,routeEmptyCartCTA:m,onItemUpdate:p,onItemRemove:h,maxItems:N,slots:l,attributesToHide:o=[],enableRemoveItem:P,enableUpdateItemQuantity:z,onItemsErrorsChange:Q,...Y})=>{var q;const[R,H]=_(!g),[a,b]=_(g),[v,tt]=_(new Set),[I,et]=_(new Map),c=(q=xt.config)==null?void 0:q.shoppingCartDisplaySetting,i=Ot({file:"Cart.CartItem.file",files:"Cart.CartItem.files",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",recipient:"Cart.CartItem.recipient",regularPrice:"Cart.CartItem.regularPrice",discountedPrice:"Cart.CartItem.discountedPrice",sender:"Cart.CartItem.sender",lowInventory:"Cart.CartItem.lowInventory",insufficientQuantity:"Cart.CartItem.insufficientQuantity",insufficientQuantityGeneral:"Cart.CartItem.insufficientQuantityGeneral",outOfStockHeading:"Cart.OutOfStockMessage.heading",outOfStockDescription:"Cart.OutOfStockMessage.message",outOfStockAlert:"Cart.OutOfStockMessage.alert",removeAction:"Cart.OutOfStockMessage.action",notAvailableMessage:"Cart.CartItem.notAvailableMessage"}),G=(t,e)=>{tt(n=>(e?n.add(t):n.delete(t),new Set(n)))},F=(t,e)=>{et(n=>(e?n.set(t,e):n.delete(t),new Map(n)))},A=(t,e)=>{G(t.uid,!0),F(t.uid),P&&e===0?J([{uid:t.uid,quantity:e}]).then(()=>{h==null||h({item:t})}).finally(()=>{G(t.uid,!1)}).catch(n=>{console.warn(n)}):z&&J([{uid:t.uid,quantity:e}]).then(()=>{p==null||p({item:t})}).finally(()=>{G(t.uid,!1)}).catch(n=>{console.warn(n),F(t.uid,n.message)})};T(()=>{const t=_t.on("cart/data",e=>{b(e),H(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),T(()=>{Q&&Q(I)},[I,Q]);const nt=(t,e)=>{if(o.includes("image"))return;const n=r(Et,{"data-testid":"cart-list-item-image",loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return f?r("a",{href:f(t),children:n}):n},rt=t=>{if(!o.includes("name"))return r("span",{"data-testid":"cart-list-item-title",children:f?r("a",{href:f(t),children:t.name}):t.name})},at=t=>{if(!o.includes("configurations"))return{...t.bundleOptions,...t.selectedOptions,...t.customizableOptions,...t.recipient?{[i.recipient]:t.recipient}:null,...t.recipientEmail&&t.recipient?{[i.recipient]:`${t.recipient} (${t.recipientEmail})`}:null,...t.sender?{[i.sender]:t.sender}:null,...t.senderEmail&&t.sender?{[i.sender]:`${t.sender} (${t.senderEmail})`}:{},...t.message?{[i.message]:t.message}:null,...t.links&&t.links.count?t.links.count>1?{[i.files.replace("{count}",t.links.count.toString())]:t.links.result}:{[i.file.replace("{count}",t.links.count.toString())]:t.links.result}:null}},it=t=>{var e,n,d,u;return(c==null?void 0:c.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(e=t.taxedPrice)==null?void 0:e.value,currency:(n=t.taxedPrice)==null?void 0:n.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(d=t.regularPrice)==null?void 0:d.value,currency:(u=t.regularPrice)==null?void 0:u.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},ct=t=>(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX"?r(O,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,ot=t=>{var d,u,y,S,L,C,w,M,W,B;const e={"aria-label":i.regularPrice},n=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(c==null?void 0:c.price)?(e.amount=(d=t.rowTotalIncludingTax)==null?void 0:d.value,e.currency=(u=t.rowTotalIncludingTax)==null?void 0:u.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",n&&(e.amount=(y=t.total)==null?void 0:y.value,e.currency=(S=t.total)==null?void 0:S.currency,n.amount=(L=t.rowTotalIncludingTax)==null?void 0:L.value,n.currency=(C=t.rowTotalIncludingTax)==null?void 0:C.currency,n.sale=!0,n["aria-label"]=i.discountedPrice,n["data-testid"]="discount-total")):(e.amount=(w=t.total)==null?void 0:w.value,e.currency=(M=t.total)==null?void 0:M.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",n&&(n.amount=(W=t.discountedTotal)==null?void 0:W.value,n.currency=(B=t.discountedTotal)==null?void 0:B.currency,n.sale=!0,n["aria-label"]=i.regularPrice,n["data-testid"]="discount-total")),{totalProps:e,discountProps:n}},st=t=>{var L,C,w;if(o.includes("warning"))return;const e=I.get(t.uid),n=(L=I.get(t.uid))==null?void 0:L.includes("The requested qty is not available"),d=v.has(t.uid),u=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(C=t.stockLevel)==null?void 0:C.toString()).replace("{count}",t.quantity.toString()):"",y=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(w=t.onlyXLeftInStock)==null?void 0:w.toString()),S=!t.outOfStock&&e&&n?i.notAvailableMessage:e;return!d&&(e||t.insufficientQuantity||t.lowInventory)?k("span",{"data-testid":"item-warning",children:[r(j,{source:Nt,size:"16"}),S||u||y]}):void 0},lt=t=>o!=null&&o.includes("alert")?void 0:!v.has(t.uid)&&t.outOfStock?k("span",{"data-testid":"item-alert",children:[r(j,{source:K,size:"16"}),i.outOfStockAlert]}):void 0,ut=t=>{if(!o.includes("sku"))return r("span",{"data-testid":"cart-list-item-sku",children:t.sku})},dt=t=>r(X,{name:"Footer",slot:l==null?void 0:l.Footer,context:{item:t}}),U=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,n)=>{const{totalProps:d,discountProps:u}=ot(e);return r(It,{updating:v==null?void 0:v.has(e.uid),"data-testid":`cart-list-item-entry-${e.uid}`,image:nt(e,n),title:rt(e),sku:ut(e),price:o.includes("price")?void 0:r(O,{...it(e)}),quantity:o.includes("quantity")?void 0:e.quantity,total:k(Z,{children:[o.includes("total")?void 0:r(O,{...d}),o.includes("totalDiscount")?void 0:u&&r(O,{...u})]}),configurations:at(e),totalExcludingTax:o.includes("totalExcludingTax")?void 0:ct(e),taxIncluded:(c==null?void 0:c.price)==="INCLUDING_TAX",taxExcluded:!o.includes("totalExcludingTax")&&(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX",warning:st(e),alert:lt(e),onQuantity:z?y=>{A(e,y)}:void 0,onRemove:P?()=>A(e,0):void 0,footer:dt(e)},e.uid)}):null,gt=r(X,{name:"EmptyCart",slot:l==null?void 0:l.EmptyCart,context:{},children:r(mt,{"data-testid":"empty-cart",ctaLinkURL:m==null?void 0:m()})}),ft=r(X,{name:"Heading",slot:l==null?void 0:l.Heading,context:{count:a==null?void 0:a.totalQuantity},children:r("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),pt=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{A(e,0)})},ht=U(t=>t.outOfStock||t.insufficientQuantity||!1),yt=a!=null&&a.hasOutOfStockItems?r(wt,{"data-testid":"cart-out-of-stock-message",icon:r(j,{source:K,size:"16"}),itemList:r(D,{"data-testid":"out-of-stock-cart-items",children:ht}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&P?[{label:i.removeAction,onClick:pt}]:void 0}):void 0,E=U(t=>!t.outOfStock&&!t.insufficientQuantity),kt=a!=null&&a.totalQuantity?r(D,{"data-testid":"cart-list",children:E==null?void 0:E.slice(0,N??E.length)}):null;return r(Pt,{...Y,heading:$?void 0:ft,loading:R,emptyCart:gt,products:kt,outOfStockMessage:yt})};Gt.getInitialData=async function(){return St()};export{Gt as C};
1
+ import{jsx as r,jsxs as k,Fragment as Z}from"@dropins/tools/preact-jsx-runtime.js";import*as s from"@dropins/tools/preact-compat.js";import{useState as _,useEffect as T}from"@dropins/tools/preact-compat.js";import{classes as x,VComponent as V,Slot as X}from"@dropins/tools/lib.js";/* empty css */import{E as mt}from"./EmptyCart.js";import{Divider as vt,Skeleton as Lt,SkeletonRow as Ct,InLineAlert as wt,Icon as j,CartList as b,CartItem as It,Price as O,Image as Et}from"@dropins/tools/components.js";import{g as St}from"./persisted-data.js";import{events as _t}from"@dropins/tools/event-bus.js";import{s as xt}from"./resetCart.js";import{u as D}from"./updateProductsFromCart.js";import{useText as Ot}from"@dropins/tools/i18n.js";const J=g=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...g},s.createElement("g",{clipPath:"url(#clip0_4797_15331)"},s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.25 20.91L1.5 17.55V6.51996L10.25 9.92996V20.91Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19 13.31L15.5 19.37H22.5L19 13.31Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19.0202 17.11H18.9802L18.9502 15.56H19.0502L19.0202 17.11ZM18.9602 18.29V18.06H19.0502V18.29H18.9602Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19 12.16V6.51996L10.25 9.92996V20.91L14.27 19.37L14.4 19.32",stroke:"currentColor",strokeLinejoin:"round"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.51999L10.25 3.04999L19 6.51999L10.25 9.92999L1.5 6.51999Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_4797_15331"},s.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"})))),Pt=g=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...g},s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),Nt=({className:g,children:$,heading:f,emptyCart:m,products:p,outOfStockMessage:h,loading:P=!0,...l})=>r("div",{...l,className:x(["cart-cart-summary-list",g]),children:P?r(Qt,{}):k(Z,{children:[(f||h)&&k("div",{"data-testid":"cart-summary-list-heading-wrapper",className:x(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!p]]),children:[f&&k(Z,{children:[r(V,{node:f,className:"cart-cart-summary-list__heading-text"}),r(vt,{variant:"primary",className:x(["cart-cart-summary-list__heading-divider"])})]}),h&&r(V,{node:h,className:"cart-cart-summary-list__out-of-stock-message"})]}),r("div",{className:x(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!p]]),children:p||r(V,{node:m,className:"cart-cart-summary-list__empty-cart"})})]})}),Qt=()=>r(Lt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:r(Ct,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),At=({initialData:g=null,hideHeading:$,routeProduct:f,routeEmptyCartCTA:m,onItemUpdate:p,onItemRemove:h,maxItems:P,slots:l,attributesToHide:o=[],enableRemoveItem:N,enableUpdateItemQuantity:z,onItemsErrorsChange:Q,...K})=>{var M;const[Y,R]=_(!g),[a,H]=_(g),[v,tt]=_(new Set),[I,et]=_(new Map),c=(M=xt.config)==null?void 0:M.shoppingCartDisplaySetting,i=Ot({file:"Cart.CartItem.file",files:"Cart.CartItem.files",heading:"Cart.Cart.heading",message:"Cart.CartItem.message",recipient:"Cart.CartItem.recipient",regularPrice:"Cart.CartItem.regularPrice",discountedPrice:"Cart.CartItem.discountedPrice",sender:"Cart.CartItem.sender",lowInventory:"Cart.CartItem.lowInventory",insufficientQuantity:"Cart.CartItem.insufficientQuantity",insufficientQuantityGeneral:"Cart.CartItem.insufficientQuantityGeneral",outOfStockHeading:"Cart.OutOfStockMessage.heading",outOfStockDescription:"Cart.OutOfStockMessage.message",outOfStockAlert:"Cart.OutOfStockMessage.alert",removeAction:"Cart.OutOfStockMessage.action",notAvailableMessage:"Cart.CartItem.notAvailableMessage"}),A=(t,e)=>{tt(n=>(e?n.add(t):n.delete(t),new Set(n)))},U=(t,e)=>{et(n=>(e?n.set(t,e):n.delete(t),new Map(n)))},G=(t,e)=>{A(t.uid,!0),U(t.uid),N&&e===0?D([{uid:t.uid,quantity:e}]).then(()=>{h==null||h({item:t})}).finally(()=>{A(t.uid,!1)}).catch(n=>{console.warn(n)}):z&&D([{uid:t.uid,quantity:e}]).then(()=>{p==null||p({item:t})}).finally(()=>{A(t.uid,!1)}).catch(n=>{console.warn(n),U(t.uid,n.message)})};T(()=>{const t=_t.on("cart/data",e=>{H(e),R(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),T(()=>{Q&&Q(I)},[I,Q]);const nt=(t,e)=>{if(o.includes("image"))return;const n=r(Et,{"data-testid":"cart-list-item-image",loading:e<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return f?r("a",{href:f(t),children:n}):n},rt=t=>{if(!o.includes("name"))return r("span",{"data-testid":"cart-list-item-title",children:f?r("a",{href:f(t),children:t.name}):t.name})},at=t=>{if(!o.includes("configurations"))return{...t.bundleOptions,...t.selectedOptions,...t.customizableOptions,...t.recipient?{[i.recipient]:t.recipient}:null,...t.recipientEmail&&t.recipient?{[i.recipient]:`${t.recipient} (${t.recipientEmail})`}:null,...t.sender?{[i.sender]:t.sender}:null,...t.senderEmail&&t.sender?{[i.sender]:`${t.sender} (${t.senderEmail})`}:{},...t.message?{[i.message]:t.message}:null,...t.links&&t.links.count?t.links.count>1?{[i.files.replace("{count}",t.links.count.toString())]:t.links.result}:{[i.file.replace("{count}",t.links.count.toString())]:t.links.result}:null}},it=t=>{var e,n,d,u;return(c==null?void 0:c.price)==="INCLUDING_TAX"?t.discounted?{amount:t.regularPrice.value,currency:t.regularPrice.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(e=t.taxedPrice)==null?void 0:e.value,currency:(n=t.taxedPrice)==null?void 0:n.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(d=t.regularPrice)==null?void 0:d.value,currency:(u=t.regularPrice)==null?void 0:u.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},ct=t=>(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX"?r(O,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,ot=t=>{var d,u,y,S,L,C,w,W,B,F;const e={"aria-label":i.regularPrice},n=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(c==null?void 0:c.price)?(e.amount=(d=t.rowTotalIncludingTax)==null?void 0:d.value,e.currency=(u=t.rowTotalIncludingTax)==null?void 0:u.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="including-tax-item-total",n&&(e.amount=(y=t.total)==null?void 0:y.value,e.currency=(S=t.total)==null?void 0:S.currency,n.amount=(L=t.rowTotalIncludingTax)==null?void 0:L.value,n.currency=(C=t.rowTotalIncludingTax)==null?void 0:C.currency,n.sale=!0,n["aria-label"]=i.discountedPrice,n["data-testid"]="discount-total")):(e.amount=(w=t.total)==null?void 0:w.value,e.currency=(W=t.total)==null?void 0:W.currency,e.variant=t.discounted?"strikethrough":"default",e["data-testid"]="regular-item-total",n&&(n.amount=(B=t.discountedTotal)==null?void 0:B.value,n.currency=(F=t.discountedTotal)==null?void 0:F.currency,n.sale=!0,n["aria-label"]=i.regularPrice,n["data-testid"]="discount-total")),{totalProps:e,discountProps:n}},st=t=>{var L,C,w;if(o.includes("warning"))return;const e=I.get(t.uid),n=(L=I.get(t.uid))==null?void 0:L.includes("The requested qty is not available"),d=v.has(t.uid),u=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(C=t.stockLevel)==null?void 0:C.toString()).replace("{count}",t.quantity.toString()):"",y=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(w=t.onlyXLeftInStock)==null?void 0:w.toString()),S=!t.outOfStock&&e&&n?i.notAvailableMessage:e;return!d&&(e||t.insufficientQuantity||t.lowInventory)?k("span",{"data-testid":"item-warning",children:[r(j,{source:Pt,size:"16"}),S||u||y]}):void 0},lt=t=>o!=null&&o.includes("alert")?void 0:!v.has(t.uid)&&t.outOfStock?k("span",{"data-testid":"item-alert",children:[r(j,{source:J,size:"16"}),i.outOfStockAlert]}):void 0,ut=t=>r(X,{name:"ProductAttributes",slot:l==null?void 0:l.ProductAttributes,context:{item:t}}),dt=t=>{if(!o.includes("sku"))return r("span",{"data-testid":"cart-list-item-sku",children:t.sku})},q=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,n)=>{const{totalProps:d,discountProps:u}=ot(e);return r(It,{updating:v==null?void 0:v.has(e.uid),"data-testid":`cart-list-item-entry-${e.uid}`,image:nt(e,n),title:rt(e),sku:dt(e),price:o.includes("price")?void 0:r(O,{...it(e)}),quantity:o.includes("quantity")?void 0:e.quantity,total:k(Z,{children:[o.includes("total")?void 0:r(O,{...d}),o.includes("totalDiscount")?void 0:u&&r(O,{...u})]}),attributes:ut(e),configurations:at(e),totalExcludingTax:o.includes("totalExcludingTax")?void 0:ct(e),taxIncluded:(c==null?void 0:c.price)==="INCLUDING_TAX",taxExcluded:!o.includes("totalExcludingTax")&&(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX",warning:st(e),alert:lt(e),onQuantity:z?y=>{G(e,y)}:void 0,onRemove:N?()=>G(e,0):void 0},e.uid)}):null,gt=r(X,{name:"EmptyCart",slot:l==null?void 0:l.EmptyCart,context:{},children:r(mt,{"data-testid":"empty-cart",ctaLinkURL:m==null?void 0:m()})}),ft=r(X,{name:"Heading",slot:l==null?void 0:l.Heading,context:{count:a==null?void 0:a.totalQuantity},children:r("div",{"data-testid":"default-cart-heading",children:i.heading.replace("({count})",a!=null&&a.totalQuantity?`(${a==null?void 0:a.totalQuantity.toString()})`:"")})}),pt=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{G(e,0)})},ht=q(t=>t.outOfStock||t.insufficientQuantity||!1),yt=a!=null&&a.hasOutOfStockItems?r(wt,{"data-testid":"cart-out-of-stock-message",icon:r(j,{source:J,size:"16"}),itemList:r(b,{"data-testid":"out-of-stock-cart-items",children:ht}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&N?[{label:i.removeAction,onClick:pt}]:void 0}):void 0,E=q(t=>!t.outOfStock&&!t.insufficientQuantity),kt=a!=null&&a.totalQuantity?r(b,{"data-testid":"cart-list",children:E==null?void 0:E.slice(0,P??E.length)}):null;return r(Nt,{...K,heading:$?void 0:ft,loading:Y,emptyCart:gt,products:kt,outOfStockMessage:yt})};At.getInitialData=async function(){return St()};export{At as C};
@@ -17,7 +17,7 @@ export interface CartSummaryListProps extends HTMLAttributes<HTMLDivElement> {
17
17
  slots?: {
18
18
  Heading?: SlotProps;
19
19
  EmptyCart?: SlotProps;
20
- Footer?: SlotProps;
20
+ ProductAttributes?: SlotProps;
21
21
  };
22
22
  enableRemoveItem?: boolean;
23
23
  enableUpdateItemQuantity?: boolean;
@@ -88,6 +88,7 @@ export interface Item {
88
88
  outOfStock?: boolean;
89
89
  notAvailableMessage?: string;
90
90
  stockLevel?: String;
91
+ productAttributes?: Attribute[];
91
92
  }
92
93
  interface ItemError {
93
94
  id: string;
@@ -109,5 +110,14 @@ interface ItemLinks {
109
110
  count: number;
110
111
  result: string;
111
112
  }
113
+ interface AttributeOption {
114
+ value: string;
115
+ label: string;
116
+ }
117
+ interface Attribute {
118
+ code: string;
119
+ value?: string;
120
+ selected_options?: AttributeOption[];
121
+ }
112
122
  export {};
113
123
  //# sourceMappingURL=cart-model.d.ts.map
@@ -940,5 +940,84 @@ declare const complexInsufficientQuantityGeneralMessage: {
940
940
  };
941
941
  };
942
942
  };
943
- export { bundleOptions, bundleOptionsEmpty, giftCardPhysical, giftCardVirtual, simple, simpleCustomizable, configurable, configurableCustomizable, giftCard, downloadbleWithMultipleLinks, simpleLowInventory, complexInsufficientQuantity, complexInsufficientQuantityGeneralMessage, };
943
+ declare const complexWithProductAttributes: {
944
+ product: {
945
+ custom_attributesV2: {
946
+ items: ({
947
+ code: string;
948
+ value: string;
949
+ selected_options?: undefined;
950
+ } | {
951
+ code: string;
952
+ selected_options: {
953
+ value: string;
954
+ label: string;
955
+ }[];
956
+ value?: undefined;
957
+ })[];
958
+ };
959
+ name: string;
960
+ sku: string;
961
+ thumbnail: {
962
+ url: string;
963
+ label: string;
964
+ };
965
+ url_key: string;
966
+ url_suffix: string;
967
+ categories: {
968
+ url_path: string;
969
+ url_key: string;
970
+ }[];
971
+ price_range: {
972
+ maximum_price: {
973
+ regular_price: {
974
+ value: number;
975
+ currency: string;
976
+ };
977
+ final_price: {
978
+ value: number;
979
+ currency: string;
980
+ };
981
+ discount: {
982
+ amount_off: number;
983
+ percent_off: number;
984
+ };
985
+ };
986
+ };
987
+ };
988
+ __typename: string;
989
+ links: {
990
+ title: string;
991
+ url: string;
992
+ }[];
993
+ uid: string;
994
+ quantity: number;
995
+ errors: null;
996
+ prices: {
997
+ price: {
998
+ value: number;
999
+ currency: string;
1000
+ };
1001
+ total_item_discount: {
1002
+ value: number;
1003
+ currency: string;
1004
+ };
1005
+ row_total: {
1006
+ value: number;
1007
+ currency: string;
1008
+ };
1009
+ price_including_tax: {
1010
+ value: number;
1011
+ currency: string;
1012
+ };
1013
+ row_total_including_tax: {
1014
+ value: number;
1015
+ };
1016
+ original_row_total: {
1017
+ value: number;
1018
+ currency: string;
1019
+ };
1020
+ };
1021
+ };
1022
+ export { bundleOptions, bundleOptionsEmpty, giftCardPhysical, giftCardVirtual, simple, simpleCustomizable, configurable, configurableCustomizable, giftCard, downloadbleWithMultipleLinks, simpleLowInventory, complexInsufficientQuantity, complexInsufficientQuantityGeneralMessage, complexWithProductAttributes, };
944
1023
  //# sourceMappingURL=productTypesData.d.ts.map
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-cart", "version": "0.7.0-alpha010", "@dropins/tools": "0.31.0-alpha005"}
1
+ {"name": "@dropins/storefront-cart", "version": "0.7.0-alpha015", "@dropins/tools": "0.33.0-alpha6"}