@dropins/storefront-cart 0.7.0-alpha007 → 0.7.0-alpha012

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.
@@ -15,4 +15,6 @@
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
17
  export declare const CART_FRAGMENT: string;
18
+ export declare const CART_ITEMS_PAGINATION_ARGUMENTS = "\n $pageSize: Int! = 100,\n $currentPage: Int! = 1,\n $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}\n";
19
+ export declare const CUSTOMER_ACCOUNT_FRAGMENT = "\ncustomer {\n addresses {\n default_shipping\n country_id\n postcode\n region {\n region\n region_code\n region_id\n }\n }\n}";
18
20
  //# sourceMappingURL=CartFragment.d.ts.map
@@ -1,13 +1,9 @@
1
- import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib';
1
+ import { Initializer } from '@dropins/tools/types/elsie/src/lib';
2
2
  import { Lang } from '@dropins/tools/types/elsie/src/i18n';
3
- import { CartModel } from '../../data/models';
4
3
 
5
4
  type ConfigProps = {
6
5
  disableGuestCart?: boolean;
7
6
  langDefinitions?: Lang;
8
- models?: {
9
- CartModel?: Model<CartModel>;
10
- };
11
7
  };
12
8
  export declare const initialize: Initializer<ConfigProps>;
13
9
  export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
package/api.js CHANGED
@@ -1,15 +1,15 @@
1
- import{s,f as p,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a as H,b as k,c as z}from"./chunks/resetCart.js";import{C as l,t as f,c as g,g as h,a as I}from"./chunks/getStoreConfig.js";import{b as j,e as q,i as B,d as J}from"./chunks/getStoreConfig.js";import{events as d}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as _}from"./fragments.js";import{c as A,p as E}from"./chunks/acdl.js";import{u as L}from"./chunks/updateProductsFromCart.js";import{g as W,b as X,a as Z}from"./chunks/getEstimateShipping.js";import{g as rt}from"./chunks/getEstimatedTotals.js";import{g as et}from"./chunks/persisted-data.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const R=`
1
+ import{s,f as p,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a as H,b as k,c as z}from"./chunks/resetCart.js";import{C as g,a as l,t as f}from"./chunks/CartFragment.js";import{events as m}from"@dropins/tools/event-bus.js";import{c as h,p as I}from"./chunks/acdl.js";import{c as _,g as E,a as A}from"./chunks/getStoreConfig.js";import{b as j,e as q,i as B,d as J}from"./chunks/getStoreConfig.js";import{u as L}from"./chunks/updateProductsFromCart.js";import{g as W,b as X,a as Z}from"./chunks/getEstimateShipping.js";import{g as at}from"./chunks/getEstimatedTotals.js";import{g as et}from"./chunks/persisted-data.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const R=`
2
2
  mutation ADD_PRODUCTS_TO_CART_MUTATION(
3
3
  $cartId: String!,
4
4
  $cartItems: [CartItemInput!]!,
5
- ${l}
5
+ ${g}
6
6
  ) {
7
7
  addProductsToCart(
8
8
  cartId: $cartId
9
9
  cartItems: $cartItems
10
10
  ) {
11
11
  cart {
12
- ...CART_FRAGMENT
12
+ ...CartFragment
13
13
  }
14
14
  user_errors {
15
15
  code
@@ -17,10 +17,9 @@ import{s,f as p,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a
17
17
  }
18
18
  }
19
19
  }
20
-
21
- ${_}
22
- `,b=async r=>{let o=!1;const c=s.cartId||await G().then(e=>(o=!0,e));return p(R,{variables:{cartId:c,cartItems:r.map(({sku:e,parentSku:a,quantity:n,optionsUIDs:t,enteredOptions:i})=>({sku:e,parent_sku:a,quantity:n,selected_options:t,entered_options:i}))}}).then(({errors:e,data:a})=>{var i;const n=[...((i=a==null?void 0:a.addProductsToCart)==null?void 0:i.user_errors)??[],...e??[]];if(n.length>0)return T(n);const t=f(a.addProductsToCart.cart);if(d.emit("cart/updated",t),d.emit("cart/data",t),t){const m=t.items.filter(C=>r.some(({sku:u})=>u===C.sku));o?A(t,m,s.locale??"en-US"):E(t,m,s.locale??"en-US")}return t})},P=`
20
+ ${l}
21
+ `,b=async a=>{let o=!1;const n=s.cartId||await O().then(e=>(o=!0,e));return p(R,{variables:{cartId:n,cartItems:a.map(({sku:e,parentSku:r,quantity:c,optionsUIDs:t,enteredOptions:i})=>({sku:e,parent_sku:r,quantity:c,selected_options:t,entered_options:i}))}}).then(({errors:e,data:r})=>{var i;const c=[...((i=r==null?void 0:r.addProductsToCart)==null?void 0:i.user_errors)??[],...e??[]];if(c.length>0)return T(c);const t=f(r.addProductsToCart.cart);if(m.emit("cart/updated",t),m.emit("cart/data",t),t){const d=t.items.filter(C=>a.some(({sku:u})=>u===C.sku));o?h(t,d,s.locale??"en-US"):I(t,d,s.locale??"en-US")}return t})},P=`
23
22
  mutation CREATE_EMPTY_CART_MUTATION {
24
23
  createEmptyCart
25
24
  }
26
- `,G=async()=>{const{disableGuestCart:r}=g.getConfig();if(r)throw new Error("Guest cart is disabled");return await p(P).then(({data:o})=>{const c=o.createEmptyCart;return s.cartId=c,c})},F=async()=>{const r=s.authenticated?await h():await I();return d.emit("cart/updated",r),d.emit("cart/data",r),r};export{b as addProductsToCart,g as config,G as createEmptyCart,p as fetchGraphQl,j as getCartData,et as getCartDataFromCache,$ as getConfig,W as getCountries,h as getCustomerCartPayload,X as getEstimateShipping,rt as getEstimatedTotals,I as getGuestCartPayload,Z as getRegions,q as getStoreConfig,B as initialize,J as initializeCart,F as refreshCart,v as removeFetchGraphQlHeader,Q as resetCart,H as setEndpoint,k as setFetchGraphQlHeader,z as setFetchGraphQlHeaders,L as updateProductsFromCart};
25
+ `,O=async()=>{const{disableGuestCart:a}=_.getConfig();if(a)throw new Error("Guest cart is disabled");return await p(P).then(({data:o})=>{const n=o.createEmptyCart;return s.cartId=n,n})},F=async()=>{const a=s.authenticated?await E():await A();return m.emit("cart/updated",a),m.emit("cart/data",a),a};export{b as addProductsToCart,_ as config,O as createEmptyCart,p as fetchGraphQl,j as getCartData,et as getCartDataFromCache,$ as getConfig,W as getCountries,E as getCustomerCartPayload,X as getEstimateShipping,at as getEstimatedTotals,A as getGuestCartPayload,Z as getRegions,q as getStoreConfig,B as initialize,J as initializeCart,F as refreshCart,v as removeFetchGraphQlHeader,Q as resetCart,H as setEndpoint,k as setFetchGraphQlHeader,z as setFetchGraphQlHeaders,L as updateProductsFromCart};
@@ -0,0 +1,235 @@
1
+ import{s as _}from"./resetCart.js";function V(r){var n,u,e,l,c,t,o;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=_.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:(o=r.prices.subtotal_with_discount_excluding_tax)==null?void 0:o.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&&P(r)},isGuestCart:!_.authenticated,hasOutOfStockItems:M(r),hasFullyOutOfStockItems:$(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=_.config;return r.items.map(e=>{var l,c,t,o,i,s,a,g,f,m,y,v,b,d,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:((o=(t=e.configured_variant)==null?void 0:t.thumbnail)==null?void 0:o.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:(i=e.prices.original_row_total)==null?void 0:i.value,currency:(s=e.prices.original_row_total)==null?void 0:s.currency},discount:{value:e.prices.total_item_discount.value,currency:e.prices.total_item_discount.currency},regularPrice:e.__typename==="ConfigurableCartItem"?{value:(g=(a=e.configured_variant)==null?void 0:a.price_range)==null?void 0:g.maximum_price.regular_price.value,currency:(m=(f=e.configured_variant)==null?void 0:f.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:(y=e.product.price_range)==null?void 0:y.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"?((d=(b=e.configured_variant)==null?void 0:b.price_range)==null?void 0:d.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:N(e),discountPercentage:D(e),savingsAmount:F(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((s,a)=>s?`${s}, ${a.label}`:a.label,"");break;case"file":const c=new DOMParser,t=e.values[0].value,i=((l=c.parseFromString(t,"text/html").querySelector("a"))==null?void 0:l.textContent)||"";u[e.label]=i;break}}),u}function z(r){var n,u;return((n=_.config)==null?void 0:n.cartSummaryDisplayTotal)===0?r.itemsV2.items.length:((u=_.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 P(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 N(r){if(!r.not_available_message)return null;const n=r.not_available_message.match(/-?\d+/);return n?parseInt(n[0]):"noNumber"}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"})}function D(r){var u,e,l,c,t,o,i,s;let n;if(r.__typename==="ConfigurableCartItem")n=(c=(l=(e=(u=r==null?void 0:r.configured_variant)==null?void 0:u.price_range)==null?void 0:e.maximum_price)==null?void 0:l.discount)==null?void 0:c.percent_off;else{if(r.__typename==="BundleCartItem")return;n=(s=(i=(o=(t=r==null?void 0:r.product)==null?void 0:t.price_range)==null?void 0:o.maximum_price)==null?void 0:i.discount)==null?void 0:s.percent_off}if(n!==0)return Math.round(n)}function F(r){var e,l,c,t,o,i;let n,u;if(n=((l=(e=r==null?void 0:r.prices)==null?void 0:e.original_row_total)==null?void 0:l.value)-((t=(c=r==null?void 0:r.prices)==null?void 0:c.row_total)==null?void 0:t.value),u=(i=(o=r==null?void 0:r.prices)==null?void 0:o.row_total)==null?void 0:i.currency,n!==0)return{value:n,currency:u}}const p=`
2
+ customizable_options {
3
+ type
4
+ customizable_option_uid
5
+ label
6
+ is_required
7
+ values {
8
+ label
9
+ value
10
+ price{
11
+ type
12
+ units
13
+ value
14
+ }
15
+ }
16
+ }
17
+ `,T=`
18
+ price_range {
19
+ minimum_price {
20
+ regular_price {
21
+ value
22
+ currency
23
+ }
24
+ final_price {
25
+ value
26
+ currency
27
+ }
28
+ discount {
29
+ percent_off
30
+ amount_off
31
+ }
32
+ }
33
+ maximum_price {
34
+ regular_price {
35
+ value
36
+ currency
37
+ }
38
+ final_price {
39
+ value
40
+ currency
41
+ }
42
+ discount {
43
+ percent_off
44
+ amount_off
45
+ }
46
+ }
47
+ }
48
+ `,B=`
49
+ fragment CartFragment on Cart {
50
+ id
51
+ total_quantity
52
+ is_virtual
53
+ prices {
54
+ subtotal_with_discount_excluding_tax {
55
+ currency
56
+ value
57
+ }
58
+ subtotal_including_tax {
59
+ currency
60
+ value
61
+ }
62
+ subtotal_excluding_tax {
63
+ currency
64
+ value
65
+ }
66
+ grand_total {
67
+ currency
68
+ value
69
+ }
70
+ grand_total_excluding_tax {
71
+ currency
72
+ value
73
+ }
74
+ applied_taxes {
75
+ label,
76
+ amount {
77
+ value
78
+ currency
79
+ }
80
+ }
81
+ discounts {
82
+ amount {
83
+ value
84
+ currency
85
+ }
86
+ label
87
+ }
88
+ }
89
+ itemsV2 (
90
+ pageSize:$pageSize,
91
+ currentPage:$currentPage,
92
+ sort: $itemsSortInput
93
+ ) {
94
+ items {
95
+ __typename
96
+ uid
97
+ quantity
98
+ is_available
99
+ not_available_message
100
+ errors {
101
+ code
102
+ message
103
+ }
104
+
105
+ prices {
106
+ price {
107
+ value
108
+ currency
109
+ }
110
+ total_item_discount {
111
+ value
112
+ currency
113
+ }
114
+ row_total {
115
+ value
116
+ currency
117
+ }
118
+ row_total_including_tax {
119
+ value
120
+ currency
121
+ }
122
+ price_including_tax {
123
+ value
124
+ currency
125
+ }
126
+ fixed_product_taxes {
127
+ amount {
128
+ value
129
+ currency
130
+ }
131
+ label
132
+ }
133
+ original_row_total{
134
+ value
135
+ currency
136
+ }
137
+ }
138
+
139
+ product {
140
+ name
141
+ sku
142
+ thumbnail {
143
+ url
144
+ label
145
+ }
146
+ url_key
147
+ url_suffix
148
+ categories {
149
+ url_path
150
+ url_key
151
+ }
152
+ only_x_left_in_stock
153
+ stock_status
154
+ ${T}
155
+ }
156
+ ...on SimpleCartItem {
157
+ ${p}
158
+ }
159
+ ... on ConfigurableCartItem {
160
+ configurable_options {
161
+ configurable_product_option_uid
162
+ option_label
163
+ value_label
164
+ }
165
+ configured_variant {
166
+ uid
167
+ sku
168
+ only_x_left_in_stock
169
+ stock_status
170
+ thumbnail {
171
+ label
172
+ url
173
+ }
174
+ ${T}
175
+ }
176
+ ${p}
177
+ }
178
+ ... on DownloadableCartItem {
179
+ links {
180
+ sort_order
181
+ title
182
+ }
183
+ ${p}
184
+ }
185
+ ... on BundleCartItem {
186
+ bundle_options {
187
+ uid
188
+ label
189
+ values {
190
+ uid
191
+ label
192
+ }
193
+ }
194
+ }
195
+ ... on GiftCardCartItem {
196
+ message
197
+ recipient_email
198
+ recipient_name
199
+ sender_email
200
+ sender_name
201
+ amount{
202
+ currency
203
+ value
204
+ }
205
+ is_available
206
+ }
207
+ }
208
+ }
209
+ shipping_addresses {
210
+ country {
211
+ code
212
+ }
213
+ region {
214
+ code
215
+ }
216
+ postcode
217
+ }
218
+ }
219
+ `,q=`
220
+ $pageSize: Int! = 100,
221
+ $currentPage: Int! = 1,
222
+ $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}
223
+ `,U=`
224
+ customer {
225
+ addresses {
226
+ default_shipping
227
+ country_id
228
+ postcode
229
+ region {
230
+ region
231
+ region_code
232
+ region_id
233
+ }
234
+ }
235
+ }`;export{q as C,B as a,U as b,V as t};
@@ -1 +1 @@
1
- import{jsx as r,jsxs as k,Fragment as j}from"@dropins/tools/preact-jsx-runtime.js";import*as s from"@dropins/tools/preact-compat.js";import{useState as _,useEffect as F}from"@dropins/tools/preact-compat.js";import{classes as O,VComponent as V,Slot as T}from"@dropins/tools/lib.js";/* empty css */import{E as kt}from"./EmptyCart.js";import{Divider as mt,Skeleton as vt,SkeletonRow as Lt,InLineAlert as Ct,Icon as X,CartList as D,CartItem as wt,Price as x,Image as It}from"@dropins/tools/components.js";import{g as Et}from"./persisted-data.js";import{events as St}from"@dropins/tools/event-bus.js";import{s as _t}from"./resetCart.js";import{u as J}from"./updateProductsFromCart.js";import{useText as Ot}from"@dropins/tools/i18n.js";const K=d=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},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)"})))),xt=d=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},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:d,children:Z,heading:g,emptyCart:m,products:p,outOfStockMessage:h,loading:N=!0,...f})=>r("div",{...f,className:O(["cart-cart-summary-list",d]),children:N?r(Pt,{}):k(j,{children:[(g||h)&&k("div",{"data-testid":"cart-summary-list-heading-wrapper",className:O(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!p]]),children:[g&&k(j,{children:[r(V,{node:g,className:"cart-cart-summary-list__heading-text"}),r(mt,{variant:"primary",className:O(["cart-cart-summary-list__heading-divider"])})]}),h&&r(V,{node:h,className:"cart-cart-summary-list__out-of-stock-message"})]}),r("div",{className:O(["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"})})]})}),Pt=()=>r(vt,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:r(Lt,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),Qt=({initialData:d=null,hideHeading:Z,routeProduct:g,routeEmptyCartCTA:m,onItemUpdate:p,onItemRemove:h,maxItems:N,slots:f,attributesToHide:o=[],enableRemoveItem:P,enableUpdateItemQuantity:$,onItemsErrorsChange:Q,...Y})=>{var q;const[R,H]=_(!d),[a,b]=_(d),[v,tt]=_(new Set),[I,et]=_(new Map),c=(q=_t.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)))},z=(t,e)=>{et(n=>(e?n.set(t,e):n.delete(t),new Map(n)))},A=(t,e)=>{G(t.uid,!0),z(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)}):$&&J([{uid:t.uid,quantity:e}]).then(()=>{p==null||p({item:t})}).finally(()=>{G(t.uid,!1)}).catch(n=>{console.warn(n),z(t.uid,n.message)})};F(()=>{const t=St.on("cart/data",e=>{b(e),H(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),F(()=>{Q&&Q(I)},[I,Q]);const nt=(t,e)=>{if(o.includes("image"))return;const n=r(It,{"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 g?r("a",{href:g(t),children:n}):n},rt=t=>{if(!o.includes("name"))return r("span",{"data-testid":"cart-list-item-title",children:g?r("a",{href:g(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,u,l;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:(u=t.regularPrice)==null?void 0:u.value,currency:(l=t.regularPrice)==null?void 0:l.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},ct=t=>(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX"?r(x,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,ot=t=>{var u,l,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=(u=t.rowTotalIncludingTax)==null?void 0:u.value,e.currency=(l=t.rowTotalIncludingTax)==null?void 0:l.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"),u=v.has(t.uid),l=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!u&&(e||t.insufficientQuantity||t.lowInventory)?k("span",{"data-testid":"item-warning",children:[r(X,{source:xt,size:"16"}),S||l||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(X,{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})},U=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((e,n)=>{const{totalProps:u,discountProps:l}=ot(e);return r(wt,{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(x,{...it(e)}),quantity:o.includes("quantity")?void 0:e.quantity,total:k(j,{children:[o.includes("total")?void 0:r(x,{...u}),o.includes("totalDiscount")?void 0:l&&r(x,{...l})]}),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:$?y=>{A(e,y)}:void 0,onRemove:P?()=>A(e,0):void 0},e.uid)}):null,dt=r(T,{name:"EmptyCart",slot:f==null?void 0:f.EmptyCart,context:{},children:r(kt,{"data-testid":"empty-cart",ctaLinkURL:m==null?void 0:m()})}),gt=r(T,{name:"Heading",slot:f==null?void 0:f.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()})`:"")})}),ft=()=>{const t=a==null?void 0:a.items.filter(e=>e.outOfStock);t==null||t.forEach(e=>{A(e,0)})},pt=U(t=>t.outOfStock||t.insufficientQuantity||!1),ht=a!=null&&a.hasOutOfStockItems?r(Ct,{"data-testid":"cart-out-of-stock-message",icon:r(X,{source:K,size:"16"}),itemList:r(D,{"data-testid":"out-of-stock-cart-items",children:pt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&P?[{label:i.removeAction,onClick:ft}]:void 0}):void 0,E=U(t=>!t.outOfStock&&!t.insufficientQuantity),yt=a!=null&&a.totalQuantity?r(D,{"data-testid":"cart-list",children:E==null?void 0:E.slice(0,N??E.length)}):null;return r(Nt,{...Y,heading:Z?void 0:gt,loading:R,emptyCart:dt,products:yt,outOfStockMessage:ht})};Qt.getInitialData=async function(){return Et()};export{Qt as C};
1
+ import{jsx as r,jsxs as v,Fragment as j}from"@dropins/tools/preact-jsx-runtime.js";import*as s from"@dropins/tools/preact-compat.js";import{useState as O,useEffect as F}from"@dropins/tools/preact-compat.js";import{classes as P,VComponent as V,Slot as T}from"@dropins/tools/lib.js";/* empty css */import{E as It}from"./EmptyCart.js";import{Divider as wt,Skeleton as St,SkeletonRow as Et,InLineAlert as _t,Icon as X,CartList as D,CartItem as Ot,Price as S,Image as Pt}from"@dropins/tools/components.js";import{g as xt}from"./persisted-data.js";import{events as Nt}from"@dropins/tools/event-bus.js";import{s as At}from"./resetCart.js";import{u as J}from"./updateProductsFromCart.js";import{useText as Qt}from"@dropins/tools/i18n.js";const K=d=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},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)"})))),Gt=d=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},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"})),Vt=({className:d,children:Z,heading:g,emptyCart:k,products:p,outOfStockMessage:h,loading:x=!0,...f})=>r("div",{...f,className:P(["cart-cart-summary-list",d]),children:x?r(Xt,{}):v(j,{children:[(g||h)&&v("div",{"data-testid":"cart-summary-list-heading-wrapper",className:P(["cart-cart-summary-list__heading",["cart-cart-summary-list__heading--full-width",!p]]),children:[g&&v(j,{children:[r(V,{node:g,className:"cart-cart-summary-list__heading-text"}),r(wt,{variant:"primary",className:P(["cart-cart-summary-list__heading-divider"])})]}),h&&r(V,{node:h,className:"cart-cart-summary-list__out-of-stock-message"})]}),r("div",{className:P(["cart-cart-summary-list__content",["cart-cart-summary-list__content--empty",!p]]),children:p||r(V,{node:k,className:"cart-cart-summary-list__empty-cart"})})]})}),Xt=()=>r(St,{"data-testid":"cart-summary-list-skeleton",className:"cart-cart-summary-list__skeleton",rowGap:"medium",children:r(Et,{variant:"row",size:"xlarge",fullWidth:!0,lines:3,multilineGap:"small"})}),jt=({initialData:d=null,hideHeading:Z,routeProduct:g,routeEmptyCartCTA:k,onItemUpdate:p,onItemRemove:h,maxItems:x,slots:f,attributesToHide:o=[],enableRemoveItem:N,enableUpdateItemQuantity:$,onItemsErrorsChange:A,showDiscount:Y,showSavings:R,quantityType:H,dropdownOptions:b,...tt})=>{var q;const[nt,et]=O(!d),[a,rt]=O(d),[C,at]=O(new Set),[E,it]=O(new Map),c=(q=At.config)==null?void 0:q.shoppingCartDisplaySetting,i=Qt({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",discountPercent:"Cart.CartItem.discountPercentage",savingsAmount:"Cart.CartItem.savingsAmount"}),Q=(t,n)=>{at(e=>(n?e.add(t):e.delete(t),new Set(e)))},z=(t,n)=>{it(e=>(n?e.set(t,n):e.delete(t),new Map(e)))},G=(t,n)=>{Q(t.uid,!0),z(t.uid),N&&n===0?J([{uid:t.uid,quantity:n}]).then(()=>{h==null||h({item:t})}).finally(()=>{Q(t.uid,!1)}).catch(e=>{console.warn(e)}):$&&J([{uid:t.uid,quantity:n}]).then(()=>{p==null||p({item:t})}).finally(()=>{Q(t.uid,!1)}).catch(e=>{console.warn(e),z(t.uid,e.message)})};F(()=>{const t=Nt.on("cart/data",n=>{rt(n),et(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),F(()=>{A&&A(E)},[E,A]);const ct=(t,n)=>{if(o.includes("image"))return;const e=r(Pt,{"data-testid":"cart-list-item-image",loading:n<4?"eager":"lazy",src:t.image.src,alt:t.image.alt,width:"300",height:"300",params:{width:300}});return g?r("a",{href:g(t),children:e}):e},ot=t=>{if(!o.includes("name"))return r("span",{"data-testid":"cart-list-item-title",children:g?r("a",{href:g(t),children:t.name}):t.name})},st=t=>{if(o.includes("configurations"))return;const n={...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};if(Object.keys(n).length!==0)return n},lt=t=>{var n,e,u,l;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:(n=t.taxedPrice)==null?void 0:n.value,currency:(e=t.taxedPrice)==null?void 0:e.currency,style:{font:"inherit"},"data-testid":"including-tax-item-price"}:{amount:(u=t.regularPrice)==null?void 0:u.value,currency:(l=t.regularPrice)==null?void 0:l.currency,style:{font:"inherit"},"data-testid":"regular-item-price"}},ut=t=>{var n,e;return{amount:(n=t.savingsAmount)==null?void 0:n.value,currency:(e=t.savingsAmount)==null?void 0:e.currency,style:{font:"inherit"},"data-testid":"item-savings-amount"}},dt=t=>(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX"?r(S,{amount:t.rowTotal.value,currency:t.rowTotal.currency,"data-testid":"excluding-tax-total","aria-label":i.regularPrice}):void 0,gt=t=>{var u,l,y,m,L,I,w,M,W,B;const n={"aria-label":i.regularPrice},e=t.discounted?{}:null;return["INCLUDING_TAX","INCLUDING_EXCLUDING_TAX"].includes(c==null?void 0:c.price)?(n.amount=(u=t.rowTotalIncludingTax)==null?void 0:u.value,n.currency=(l=t.rowTotalIncludingTax)==null?void 0:l.currency,n.variant=t.discounted?"strikethrough":"default",n["data-testid"]="including-tax-item-total",e&&(n.amount=(y=t.total)==null?void 0:y.value,n.currency=(m=t.total)==null?void 0:m.currency,e.amount=(L=t.rowTotalIncludingTax)==null?void 0:L.value,e.currency=(I=t.rowTotalIncludingTax)==null?void 0:I.currency,e.sale=!0,e["aria-label"]=i.discountedPrice,e["data-testid"]="discount-total")):(n.amount=(w=t.total)==null?void 0:w.value,n.currency=(M=t.total)==null?void 0:M.currency,n.variant=t.discounted?"strikethrough":"default",n["data-testid"]="regular-item-total",e&&(e.amount=(W=t.discountedTotal)==null?void 0:W.value,e.currency=(B=t.discountedTotal)==null?void 0:B.currency,e.sale=!0,e["aria-label"]=i.regularPrice,e["data-testid"]="discount-total")),{totalProps:n,discountProps:e}},ft=t=>{var L,I,w;if(o.includes("warning"))return;const n=E.get(t.uid),e=(L=E.get(t.uid))==null?void 0:L.includes("The requested qty is not available"),u=C.has(t.uid),l=t.insufficientQuantity&&t.stockLevel?t.stockLevel==="noNumber"?i.insufficientQuantityGeneral:i.insufficientQuantity.replace("{inventory}",(I=t.stockLevel)==null?void 0:I.toString()).replace("{count}",t.quantity.toString()):"",y=t.lowInventory&&t.onlyXLeftInStock&&i.lowInventory.replace("{count}",(w=t.onlyXLeftInStock)==null?void 0:w.toString()),m=!t.outOfStock&&n&&e?i.notAvailableMessage:n;return!u&&(n||t.insufficientQuantity||t.lowInventory)?v("span",{"data-testid":"item-warning",children:[r(X,{source:Gt,size:"16"}),m||l||y]}):void 0},pt=t=>o!=null&&o.includes("alert")?void 0:!C.has(t.uid)&&t.outOfStock?v("span",{"data-testid":"item-alert",children:[r(X,{source:K,size:"16"}),i.outOfStockAlert]}):void 0,ht=t=>{if(!o.includes("sku"))return r("span",{"data-testid":"cart-list-item-sku",children:t.sku})},U=t=>a!=null&&a.totalQuantity?a.items.filter(t).map((n,e)=>{var y;const{totalProps:u,discountProps:l}=gt(n);return r(Ot,{updating:C==null?void 0:C.has(n.uid),"data-testid":`cart-list-item-entry-${n.uid}`,image:ct(n,e),title:ot(n),sku:ht(n),price:o.includes("price")?void 0:r(S,{...lt(n)}),quantity:o.includes("quantity")?void 0:n.quantity,total:v(j,{children:[o.includes("total")?void 0:r(S,{...u}),o.includes("totalDiscount")?void 0:l&&r(S,{...l})]}),configurations:st(n),totalExcludingTax:o.includes("totalExcludingTax")?void 0:dt(n),taxIncluded:(c==null?void 0:c.price)==="INCLUDING_TAX",taxExcluded:!o.includes("totalExcludingTax")&&(c==null?void 0:c.price)==="INCLUDING_EXCLUDING_TAX",warning:ft(n),alert:pt(n),quantityType:H,dropdownOptions:b,onQuantity:$?m=>{G(n,m)}:void 0,onRemove:N?()=>G(n,0):void 0,discount:Y&&n.discounted&&n.discountPercentage?r("div",{"data-testid":"item-discount-percent",children:i.discountPercent.replace("{discount}",((y=n.discountPercentage)==null?void 0:y.toString())??"")}):void 0,savings:R&&n.discounted&&n.savingsAmount?v("div",{children:[r("span",{children:r(S,{...ut(n)})})," ",i.savingsAmount]}):void 0},n.uid)}):null,yt=r(T,{name:"EmptyCart",slot:f==null?void 0:f.EmptyCart,context:{},children:r(It,{"data-testid":"empty-cart",ctaLinkURL:k==null?void 0:k()})}),vt=r(T,{name:"Heading",slot:f==null?void 0:f.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()})`:"")})}),mt=()=>{const t=a==null?void 0:a.items.filter(n=>n.outOfStock);t==null||t.forEach(n=>{G(n,0)})},kt=U(t=>t.outOfStock||t.insufficientQuantity||!1),Ct=a!=null&&a.hasOutOfStockItems?r(_t,{"data-testid":"cart-out-of-stock-message",icon:r(X,{source:K,size:"16"}),itemList:r(D,{"data-testid":"out-of-stock-cart-items",children:kt}),type:"warning",heading:i.outOfStockHeading,description:i.outOfStockDescription,variant:"primary",actionButtonPosition:"bottom",additionalActions:a!=null&&a.hasFullyOutOfStockItems&&N?[{label:i.removeAction,onClick:mt}]:void 0}):void 0,_=U(t=>!t.outOfStock&&!t.insufficientQuantity),Lt=a!=null&&a.totalQuantity?r(D,{"data-testid":"cart-list",children:_==null?void 0:_.slice(0,x??_.length)}):null;return r(Vt,{...tt,heading:Z?void 0:vt,loading:nt,emptyCart:yt,products:Lt,outOfStockMessage:Ct})};jt.getInitialData=async function(){return xt()};export{jt as C};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as d,Fragment as G}from"@dropins/tools/preact-jsx-runtime.js";import{useState as N,useEffect as g,useCallback as H}from"@dropins/tools/preact-compat.js";import{classes as p,VComponent as f,Slot as k}from"@dropins/tools/lib.js";import{g as M}from"./persisted-data.js";import{events as P}from"@dropins/tools/event-bus.js";/* empty css */import{Price as Q,Button as S}from"@dropins/tools/components.js";import{useText as T}from"@dropins/tools/i18n.js";import{s as _}from"./resetCart.js";import{a as D,b as X}from"./acdl.js";import{u as O}from"./updateProductsFromCart.js";import"./CartSummaryGrid.js";import{C as R}from"./CartSummaryList.js";import"./OrderSummary.js";const j=({className:h,products:n,orderSummary:i,empty:r,...a})=>e("div",{...a,className:p(["cart-cart",h]),children:d("div",{className:p(["cart-cart__wrapper"]),children:[e("div",{"data-testid":"cart-content",className:p(["cart-cart__content",["cart-cart__content--empty",r||i==null],["cart-cart__content--full-width",r||i==null]]),children:n&&e(f,{node:n})}),n&&i&&e(f,{node:i,className:p(["cart-cart__order-summary"])})]})}),A=({className:h,products:n,subtotal:i,subtotalExcludingTaxes:r,ctas:a,...m})=>{const o=T({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return e("div",{...m,className:p(["cart-mini-cart",h]),children:n&&d(G,{children:[e("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:n}),d("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[i&&d("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[o.subtotal,e(f,{node:i})]}),r&&d("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[o.subtotalExcludingTaxes,e(f,{node:r,className:p(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),a&&e(f,{node:a,className:"cart-mini-cart__footer__ctas"})]})]})})},F=({children:h,routeProduct:n,routeEmptyCartCTA:i,slots:r,initialData:a=null,...m})=>{const[o,v]=N(a),[t,C]=N(new Map),c={hasErrors:t.size>0},b=(s,y)=>O([{uid:s,quantity:y}]);g(()=>{const s=P.on("cart/data",y=>{v(y)},{eager:!0});return()=>{s==null||s.off()}},[]),g(()=>{a&&Object.keys(a).length>0&&D(a,_.locale??"en-US")},[a]);const x=r!=null&&r.OrderSummary?e(k,{name:"OrderSummary",slot:r.OrderSummary,context:{...c}}):void 0,I=s=>b(s,0),u=e(k,{name:"ProductList",slot:r==null?void 0:r.ProductList,context:{itemQuantityUpdateHandler:b,itemRemoveHandler:I},children:e(R,{"data-testid":"default-cart-summary-list",routeProduct:n,routeEmptyCartCTA:i,initialData:o,enableRemoveItem:!0,enableUpdateItemQuantity:!0,onItemsErrorsChange:C})});return e(j,{...m,empty:((o==null?void 0:o.items)&&o.items.length===0)??!0,orderSummary:x,products:u})};F.getInitialData=async function(){return M()};const V=({children:h,initialData:n=null,slots:i,routeProduct:r,routeCart:a,routeCheckout:m,routeEmptyCartCTA:o,...v})=>{var U,E;const[t,C]=N(n),c=(U=_.config)==null?void 0:U.shoppingCartDisplaySetting;g(()=>{const l=P.on("cart/data",L=>{C(L)},{eager:!0});return()=>{l==null||l.off()}},[]);const b=T({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),x=(l,L)=>O([{uid:l,quantity:L}]),I=l=>x(l,0),u=t==null?void 0:t.hasOutOfStockItems,s=H(()=>{t&&!u&&X(t,_.locale)},[t,u]);g(()=>{n&&Object.keys(n).length>0&&D(n,_.locale||"en-US")},[n]);const y=e(k,{name:"ProductList",slot:i==null?void 0:i.ProductList,context:{itemQuantityUpdateHandler:x,itemRemoveHandler:I,totalQuantity:t==null?void 0:t.totalQuantity},children:e(R,{"data-testid":"default-cart-summary-list",routeProduct:r,routeEmptyCartCTA:o,initialData:t,maxItems:(E=_.config)==null?void 0:E.miniCartMaxItemsDisplay,hideHeading:!(t!=null&&t.totalQuantity),enableRemoveItem:!0})}),w=()=>(c==null?void 0:c.subtotal)==="INCLUDING_TAX"||(c==null?void 0:c.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 e(A,{...v,subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&e(Q,{...w()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((c==null?void 0:c.subtotal)==="INCLUDING_EXCLUDING_TAX"?e(Q,{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,ctas:t!=null&&t.totalQuantity?d("div",{children:[m&&e(S,{"data-testid":"route-checkout-button",variant:"primary",href:u?void 0:m(),disabled:u,"aria-disabled":u,onClick:s,children:b.checkoutLink}),a&&e(S,{"data-testid":"route-cart-button",variant:"tertiary",href:a(),children:b.cartLink})]}):void 0,products:y})};V.getInitialData=async function(){return M()};export{F as C,V as M};
1
+ import{jsx as e,jsxs as h,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import{useState as Q,useEffect as C,useCallback as j}from"@dropins/tools/preact-compat.js";import{classes as b,VComponent as f,Slot as S}from"@dropins/tools/lib.js";import{g as D}from"./persisted-data.js";import{events as O}from"@dropins/tools/event-bus.js";/* empty css */import{Price as P,Button as T}from"@dropins/tools/components.js";import{useText as R}from"@dropins/tools/i18n.js";import{s as _}from"./resetCart.js";import{a as w,b as A}from"./acdl.js";import{u as G}from"./updateProductsFromCart.js";import"./CartSummaryGrid.js";import{C as H}from"./CartSummaryList.js";import"./OrderSummary.js";const F=({className:y,products:n,orderSummary:i,empty:r,...c})=>e("div",{...c,className:b(["cart-cart",y]),children:h("div",{className:b(["cart-cart__wrapper"]),children:[e("div",{"data-testid":"cart-content",className:b(["cart-cart__content",["cart-cart__content--empty",r||i==null],["cart-cart__content--full-width",r||i==null]]),children:n&&e(f,{node:n})}),n&&i&&e(f,{node:i,className:b(["cart-cart__order-summary"])})]})}),V=({className:y,products:n,subtotal:i,subtotalExcludingTaxes:r,ctas:c,...m})=>{const d=R({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return e("div",{...m,className:b(["cart-mini-cart",y]),children:n&&h(X,{children:[e("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:n}),h("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[i&&h("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[d.subtotal,e(f,{node:i})]}),r&&h("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[d.subtotalExcludingTaxes,e(f,{node:r,className:b(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),c&&e(f,{node:c,className:"cart-mini-cart__footer__ctas"})]})]})})},$=({children:y,routeProduct:n,routeEmptyCartCTA:i,slots:r,showDiscount:c,showSavings:m,quantityType:d,dropdownOptions:I,initialData:s=null,...L})=>{const[t,N]=Q(s),[a,x]=Q(new Map),g={hasErrors:a.size>0},v=(o,p)=>G([{uid:o,quantity:p}]);C(()=>{const o=O.on("cart/data",p=>{N(p)},{eager:!0});return()=>{o==null||o.off()}},[]),C(()=>{s&&Object.keys(s).length>0&&w(s,_.locale??"en-US")},[s]);const u=r!=null&&r.OrderSummary?e(S,{name:"OrderSummary",slot:r.OrderSummary,context:{...g}}):void 0,k=o=>v(o,0),U=e(S,{name:"ProductList",slot:r==null?void 0:r.ProductList,context:{itemQuantityUpdateHandler:v,itemRemoveHandler:k},children:e(H,{"data-testid":"default-cart-summary-list",routeProduct:n,routeEmptyCartCTA:i,initialData:t,enableRemoveItem:!0,enableUpdateItemQuantity:!0,onItemsErrorsChange:x,showDiscount:c,showSavings:m,quantityType:d,dropdownOptions:I})});return e(F,{...L,empty:((t==null?void 0:t.items)&&t.items.length===0)??!0,orderSummary:u,products:U})};$.getInitialData=async function(){return D()};const z=({children:y,initialData:n=null,slots:i,routeProduct:r,routeCart:c,routeCheckout:m,routeEmptyCartCTA:d,showDiscount:I,showSavings:s,...L})=>{var p,M;const[t,N]=Q(n),a=(p=_.config)==null?void 0:p.shoppingCartDisplaySetting;C(()=>{const l=O.on("cart/data",E=>{N(E)},{eager:!0});return()=>{l==null||l.off()}},[]);const x=R({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),g=(l,E)=>G([{uid:l,quantity:E}]),v=l=>g(l,0),u=t==null?void 0:t.hasOutOfStockItems,k=j(()=>{t&&!u&&A(t,_.locale)},[t,u]);C(()=>{n&&Object.keys(n).length>0&&w(n,_.locale||"en-US")},[n]);const U=e(S,{name:"ProductList",slot:i==null?void 0:i.ProductList,context:{itemQuantityUpdateHandler:g,itemRemoveHandler:v,totalQuantity:t==null?void 0:t.totalQuantity},children:e(H,{"data-testid":"default-cart-summary-list",routeProduct:r,routeEmptyCartCTA:d,initialData:t,maxItems:(M=_.config)==null?void 0:M.miniCartMaxItemsDisplay,hideHeading:!(t!=null&&t.totalQuantity),enableRemoveItem:!0,showDiscount:I,showSavings:s})}),o=()=>(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 e(V,{...L,subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&e(P,{...o()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?e(P,{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,ctas:t!=null&&t.totalQuantity?h("div",{children:[m&&e(T,{"data-testid":"route-checkout-button",variant:"primary",href:u?void 0:m(),disabled:u,"aria-disabled":u,onClick:k,children:x.checkoutLink}),c&&e(T,{"data-testid":"route-cart-button",variant:"tertiary",href:c(),children:x.cartLink})]}):void 0,products:U})};z.getInitialData=async function(){return D()};export{$ as C,z as M};
@@ -1,9 +1,10 @@
1
- import{s as h,f as T,h as m}from"./resetCart.js";import{C as A,t as E}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{CART_FRAGMENT as I}from"../fragments.js";const u=`
1
+ import{s as _,f as m,h as T}from"./resetCart.js";import{C as E,a as I,t as u}from"./CartFragment.js";import"@dropins/tools/event-bus.js";const A=`
2
2
  mutation GET_ESTIMATED_TOTALS_MUTATION(
3
3
  $cartId: String!
4
4
  $address: EstimateAddressInput!,
5
5
  $shipping_method: ShippingMethodInput,
6
- ${A}
6
+ ${E}
7
+
7
8
  ) {
8
9
  estimateTotals(
9
10
  input: {
@@ -13,10 +14,9 @@ import{s as h,f as T,h as m}from"./resetCart.js";import{C as A,t as E}from"./get
13
14
  }
14
15
  ) {
15
16
  cart {
16
- ...CART_FRAGMENT
17
+ ...CartFragment
17
18
  }
18
19
  }
19
20
  }
20
-
21
21
  ${I}
22
- `,S=async o=>{var e,a;const r=h.cartId;if(!r)throw new Error("No cart ID found");if(!o)throw new Error("No address parameter found");const{countryCode:s,postcode:n,region:t}=o,c=(e=o.shipping_method)==null?void 0:e.carrier_code,p=(a=o.shipping_method)==null?void 0:a.method_code;return T(u,{variables:{cartId:r,address:{country_code:s||"US",postcode:n,region:(t==null?void 0:t.id)!==void 0?{region_id:t.id}:{region:(t==null?void 0:t.region)??""}},shipping_method:{carrier_code:c||"",method_code:p||""}}}).then(({errors:d,data:_})=>{if(d)return m(d);const i=_.estimateTotals;return i?E(i.cart):null})};export{S as g};
22
+ `,M=async r=>{var e,a;const o=_.cartId;if(!o)throw new Error("No cart ID found");if(!r)throw new Error("No address parameter found");const{countryCode:i,postcode:n,region:t}=r,c=(e=r.shipping_method)==null?void 0:e.carrier_code,p=(a=r.shipping_method)==null?void 0:a.method_code;return m(A,{variables:{cartId:o,address:{country_code:i||"US",postcode:n,region:(t==null?void 0:t.id)!==void 0?{region_id:t.id}:{region:(t==null?void 0:t.region)??""}},shipping_method:{carrier_code:c||"",method_code:p||""}}}).then(({errors:d,data:h})=>{if(d)return T(d);const s=h.estimateTotals;return s?u(s.cart):null})};export{M as g};
@@ -1,63 +1,43 @@
1
- import{events as s}from"@dropins/tools/event-bus.js";import{s as i,d as U,f as y,h as d}from"./resetCart.js";import{Initializer as k,merge as D}from"@dropins/tools/lib.js";import{CART_FRAGMENT as C}from"../fragments.js";import{a as z}from"./persisted-data.js";const w=new k({init:async e=>{const t={disableGuestCart:!1,...e};w.config.setConfig(t),f().catch(console.error)},listeners:()=>[s.on("authenticated",e=>{i.authenticated&&!e?s.emit("cart/reset",void 0):e&&!i.authenticated&&(i.authenticated=e,f().catch(console.error))},{eager:!0}),s.on("locale",async e=>{e!==i.locale&&(i.locale=e,f().catch(console.error))}),s.on("cart/reset",()=>{U().catch(console.error),s.emit("cart/data",null)}),s.on("cart/data",e=>{z(e)})]}),N=w.config;function R(e){var n,r,c,a,u,p,_,o,l,g;if(!e)return null;const t={id:e.id,totalQuantity:L(e),errors:$(e==null?void 0:e.itemsV2),items:G(e==null?void 0:e.itemsV2),miniCartMaxItems:G(e==null?void 0:e.itemsV2).slice(0,((n=i.config)==null?void 0:n.miniCartMaxItemsDisplay)??10),total:{includingTax:{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency},excludingTax:{value:e.prices.grand_total_excluding_tax.value,currency:e.prices.grand_total_excluding_tax.currency}},subtotal:{excludingTax:{value:(r=e.prices.subtotal_excluding_tax)==null?void 0:r.value,currency:(c=e.prices.subtotal_excluding_tax)==null?void 0:c.currency},includingTax:{value:(a=e.prices.subtotal_including_tax)==null?void 0:a.value,currency:(u=e.prices.subtotal_including_tax)==null?void 0:u.currency},includingDiscountOnly:{value:(p=e.prices.subtotal_with_discount_excluding_tax)==null?void 0:p.value,currency:(_=e.prices.subtotal_with_discount_excluding_tax)==null?void 0:_.currency}},appliedTaxes:A(e.prices.applied_taxes),totalTax:F(e.prices.applied_taxes,e.prices.grand_total.currency),appliedDiscounts:A(e.prices.discounts),isVirtual:e.is_virtual,addresses:{shipping:e.shipping_addresses&&X(e)},isGuestCart:!i.authenticated,hasOutOfStockItems:K(e),hasFullyOutOfStockItems:B(e)};return D(t,(g=(l=(o=N.getConfig().models)==null?void 0:o.CartModel)==null?void 0:l.transformer)==null?void 0:g.call(l,e))}function F(e,t){return e!=null&&e.length?e.reduce((n,r)=>({value:n.value+r.amount.value,currency:r.amount.currency}),{value:0,currency:t}):{value:0,currency:t}}function G(e){var n;if(!((n=e==null?void 0:e.items)!=null&&n.length))return[];const t=i.config;return e.items.map(r=>{var c,a,u,p,_,o,l,g,b,x,T,v,I,S,E,O;return{itemType:r.__typename,uid:r.uid,url:{urlKey:r.product.url_key,categories:r.product.categories.map(M=>M.url_key)},quantity:r.quantity,sku:r.product.sku,name:r.product.name,image:{src:t!=null&&t.useConfigurableParentThumbnail?r.product.thumbnail.url:((a=(c=r.configured_variant)==null?void 0:c.thumbnail)==null?void 0:a.url)||r.product.thumbnail.url,alt:t!=null&&t.useConfigurableParentThumbnail?r.product.thumbnail.label:((p=(u=r.configured_variant)==null?void 0:u.thumbnail)==null?void 0:p.label)||r.product.thumbnail.label},price:{value:r.prices.price.value,currency:r.prices.price.currency},taxedPrice:{value:r.prices.price_including_tax.value,currency:r.prices.price_including_tax.currency},rowTotal:{value:r.prices.row_total.value,currency:r.prices.row_total.currency},rowTotalIncludingTax:{value:r.prices.row_total_including_tax.value,currency:r.prices.row_total_including_tax.currency},links:V(r.links),total:r.__typename==="SimpleCartItem"&&r.customizable_options.length!==0||r.__typename==="BundleCartItem"?{value:r.prices.row_total.value,currency:r.prices.row_total.currency}:{value:(_=r.prices.original_row_total)==null?void 0:_.value,currency:(o=r.prices.original_row_total)==null?void 0:o.currency},discount:{value:r.prices.total_item_discount.value,currency:r.prices.total_item_discount.currency},regularPrice:r.__typename==="ConfigurableCartItem"?{value:(g=(l=r.configured_variant)==null?void 0:l.price_range)==null?void 0:g.maximum_price.regular_price.value,currency:(x=(b=r.configured_variant)==null?void 0:b.price_range)==null?void 0:x.maximum_price.regular_price.currency}:r.__typename==="GiftCardCartItem"||r.__typename==="SimpleCartItem"&&r.customizable_options.length!==0||r.__typename==="BundleCartItem"?{value:r.prices.price.value,currency:r.prices.price.currency}:{value:(T=r.product.price_range)==null?void 0:T.maximum_price.regular_price.value,currency:(v=r.product.price_range)==null?void 0:v.maximum_price.regular_price.currency},discounted:r.__typename==="BundleCartItem"||r.__typename==="SimpleCartItem"&&r.customizable_options.length!==0?!1:r.__typename==="ConfigurableCartItem"?((S=(I=r.configured_variant)==null?void 0:I.price_range)==null?void 0:S.maximum_price.discount.amount_off)>0:((E=r.product.price_range)==null?void 0:E.maximum_price.discount.amount_off)>0,bundleOptions:r.__typename==="BundleCartItem"?P(r.bundle_options):null,selectedOptions:Q(r.configurable_options),customizableOptions:q(r.customizable_options),sender:r.__typename==="GiftCardCartItem"?r.sender_name:null,senderEmail:r.__typename==="GiftCardCartItem"?r.sender_email:null,recipient:r.__typename==="GiftCardCartItem"?r.recipient_name:null,recipientEmail:r.__typename==="GiftCardCartItem"?r.recipient_email:null,message:r.__typename==="GiftCardCartItem"?r.message:null,discountedTotal:{value:r.prices.row_total.value,currency:r.prices.row_total.currency},onlyXLeftInStock:r.__typename==="ConfigurableCartItem"?(O=r.configured_variant)==null?void 0:O.only_x_left_in_stock:r.product.only_x_left_in_stock,lowInventory:r.is_available&&r.product.only_x_left_in_stock!==null,insufficientQuantity:(r.__typename==="ConfigurableCartItem"?r.configured_variant:r.product).stock_status==="IN_STOCK"&&!r.is_available,outOfStock:r.product.stock_status==="OUT_OF_STOCK",stockLevel:Y(r)}})}function $(e){var n;const t=(n=e==null?void 0:e.items)==null?void 0:n.reduce((r,c)=>{var a;return(a=c.errors)==null||a.forEach(u=>{r.push({uid:c.uid,text:u.message})}),r},[]);return t!=null&&t.length?t:null}function A(e){return e!=null&&e.length?e.map(t=>({amount:{value:t.amount.value,currency:t.amount.currency},label:t.label})):[]}function P(e){const t=e==null?void 0:e.map(r=>({uid:r.uid,label:r.label,value:r.values.map(c=>c.label).join(", ")})),n={};return t==null||t.forEach(r=>{n[r.label]=r.value}),Object.keys(n).length>0?n:null}function Q(e){const t=e==null?void 0:e.map(r=>({uid:r.configurable_product_option_uid,label:r.option_label,value:r.value_label})),n={};return t==null||t.forEach(r=>{n[r.label]=r.value}),Object.keys(n).length>0?n:null}function q(e){const t=e==null?void 0:e.map(r=>({uid:r.customizable_option_uid,label:r.label,type:r.type,values:r.values.map(c=>({uid:c.customizable_option_value_uid,label:c.label,value:c.value}))})),n={};return t==null||t.forEach(r=>{var c;switch(r.type){case"field":case"area":case"date_time":n[r.label]=r.values[0].value;break;case"radio":case"drop_down":n[r.label]=r.values[0].label;break;case"multiple":case"checkbox":n[r.label]=r.values.reduce((o,l)=>o?`${o}, ${l.label}`:l.label,"");break;case"file":const a=new DOMParser,u=r.values[0].value,_=((c=a.parseFromString(u,"text/html").querySelector("a"))==null?void 0:c.textContent)||"";n[r.label]=_;break}}),n}function L(e){var t,n;return((t=i.config)==null?void 0:t.cartSummaryDisplayTotal)===0?e.itemsV2.items.length:((n=i.config)==null?void 0:n.cartSummaryDisplayTotal)===1?e.total_quantity:e.itemsV2.items.length}function V(e){return(e==null?void 0:e.length)>0?{count:e.length,result:e.map(t=>t.title).join(", ")}:null}function X(e){var t,n,r,c;return(t=e.shipping_addresses)!=null&&t.length?(n=e.shipping_addresses)==null?void 0:n.map(a=>({countryCode:a.country.code,zipCode:a.postcode,regionCode:a.region.code})):(r=e.addresses)!=null&&r.length?(c=e.addresses)==null?void 0:c.filter(a=>a.default_shipping).map(a=>{var u;return a.default_shipping&&{countryCode:a.country_id,zipCode:a.postcode,regionCode:(u=a.region)==null?void 0:u.region_code}}):null}function K(e){var t,n;return(n=(t=e==null?void 0:e.itemsV2)==null?void 0:t.items)==null?void 0:n.some(r=>{var c;return((c=r==null?void 0:r.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"||r.product.stock_status==="IN_STOCK"&&!r.is_available})}function Y(e){if(!e.not_available_message)return null;const t=e.not_available_message.match(/-?\d+/);return t?parseInt(t[0]):"noNumber"}function B(e){var t,n;return(n=(t=e==null?void 0:e.itemsV2)==null?void 0:t.items)==null?void 0:n.some(r=>{var c;return((c=r==null?void 0:r.product)==null?void 0:c.stock_status)==="OUT_OF_STOCK"})}function j(e){if(!e)return null;const t=n=>{switch(n){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}};return{displayMiniCart:e.minicart_display,miniCartMaxItemsDisplay:e.minicart_max_items,cartExpiresInDays:e.cart_expires_in_days,cartSummaryDisplayTotal:e.cart_summary_display_quantity,defaultCountry:e.default_country,categoryFixedProductTaxDisplaySetting:e.category_fixed_product_tax_display_setting,productFixedProductTaxDisplaySetting:e.product_fixed_product_tax_display_setting,salesFixedProductTaxDisplaySetting:e.sales_fixed_product_tax_display_setting,shoppingCartDisplaySetting:{zeroTax:e.shopping_cart_display_zero_tax,subtotal:t(e.shopping_cart_display_subtotal),price:t(e.shopping_cart_display_price),shipping:t(e.shopping_cart_display_shipping),fullSummary:e.shopping_cart_display_full_summary,grandTotal:e.shopping_cart_display_grand_total,taxGiftWrapping:e.shopping_cart_display_tax_gift_wrapping},useConfigurableParentThumbnail:e.configurable_thumbnail_source==="parent"}}const h=`
2
- $pageSize: Int! = 100,
3
- $currentPage: Int! = 1,
4
- $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}
5
- `,H=`
6
- fragment CUSTOMER_FRAGMENT on Customer {
7
- addresses {
8
- default_shipping
9
- country_id
10
- postcode
11
- region {
12
- region
13
- region_code
14
- region_id
15
- }
16
- }
17
- }`,W=`
1
+ import{events as e}from"@dropins/tools/event-bus.js";import{s as a,d as y,f as s,h as o}from"./resetCart.js";import{C as u,a as l,b as f,t as p}from"./CartFragment.js";import{Initializer as m}from"@dropins/tools/lib.js";import{a as C}from"./persisted-data.js";const d=new m({init:async t=>{const r={disableGuestCart:!1,...t};d.config.setConfig(r),c().catch(console.error)},listeners:()=>[e.on("authenticated",t=>{a.authenticated&&!t?e.emit("cart/reset",void 0):t&&!a.authenticated&&(a.authenticated=t,c().catch(console.error))},{eager:!0}),e.on("locale",async t=>{t!==a.locale&&(a.locale=t,c().catch(console.error))}),e.on("cart/reset",()=>{y().catch(console.error),e.emit("cart/data",null)}),e.on("cart/data",t=>{C(t)})]}),h=d.config;function T(t){if(!t)return null;const r=i=>{switch(i){case 1:return"EXCLUDING_TAX";case 2:return"INCLUDING_TAX";case 3:return"INCLUDING_EXCLUDING_TAX";default:return"EXCLUDING_TAX"}};return{displayMiniCart:t.minicart_display,miniCartMaxItemsDisplay:t.minicart_max_items,cartExpiresInDays:t.cart_expires_in_days,cartSummaryDisplayTotal:t.cart_summary_display_quantity,defaultCountry:t.default_country,categoryFixedProductTaxDisplaySetting:t.category_fixed_product_tax_display_setting,productFixedProductTaxDisplaySetting:t.product_fixed_product_tax_display_setting,salesFixedProductTaxDisplaySetting:t.sales_fixed_product_tax_display_setting,shoppingCartDisplaySetting:{zeroTax:t.shopping_cart_display_zero_tax,subtotal:r(t.shopping_cart_display_subtotal),price:r(t.shopping_cart_display_price),shipping:r(t.shopping_cart_display_shipping),fullSummary:t.shopping_cart_display_full_summary,grandTotal:t.shopping_cart_display_grand_total,taxGiftWrapping:t.shopping_cart_display_tax_gift_wrapping},useConfigurableParentThumbnail:t.configurable_thumbnail_source==="parent"}}const x=`
18
2
  query GUEST_CART_QUERY(
19
3
  $cartId: String!,
20
- ${h}
4
+ ${u}
21
5
  ) {
22
6
 
23
7
  cart(cart_id: $cartId){
24
- ...CART_FRAGMENT
8
+ ...CartFragment
25
9
  }
26
10
  }
27
11
 
28
- ${C}
29
- `,J=`
12
+ ${l}
13
+ `,I=`
30
14
  query CUSTOMER_CART_QUERY(
31
- ${h}
15
+ ${u}
32
16
  ) {
33
-
34
- customer {
35
- ...CUSTOMER_FRAGMENT
36
- }
17
+ ${f}
37
18
 
38
19
  cart: customerCart {
39
- ...CART_FRAGMENT
20
+ ...CartFragment
40
21
  }
41
22
  }
42
23
 
43
- ${H}
44
- ${C}
45
- `,m=async()=>{const e=i.authenticated,t=i.cartId;if(e)return y(J,{method:"POST"}).then(({errors:n,data:r})=>{if(n)return d(n);const c={...r.cart,...r.customer};return R(c)});if(!t)throw new Error("No cart ID found");return y(W,{method:"POST",cache:"no-cache",variables:{cartId:t}}).then(({errors:n,data:r})=>n?d(n):R(r.cart))},Z=`
24
+ ${l}
25
+ `,_=async()=>{const t=a.authenticated,r=a.cartId;if(t)return s(I,{method:"POST"}).then(({errors:i,data:n})=>{if(i)return o(i);const g={...n.cart,...n.customer};return p(g)});if(!r)throw new Error("No cart ID found");return s(x,{method:"POST",cache:"no-cache",variables:{cartId:r}}).then(({errors:i,data:n})=>i?o(i):p(n.cart))},E=`
46
26
  mutation MERGE_CARTS_MUTATION(
47
27
  $guestCartId: String!,
48
28
  $customerCartId: String!,
49
- ${h}
29
+ ${u}
50
30
  ) {
51
31
  mergeCarts(
52
32
  source_cart_id: $guestCartId,
53
33
  destination_cart_id: $customerCartId
54
34
  ) {
55
- ...CART_FRAGMENT
35
+ ...CartFragment
56
36
  }
57
37
  }
58
38
 
59
- ${C}
60
- `,f=async()=>{if(i.initializing)return null;i.initializing=!0,i.config||(i.config=await ne());const e=i.authenticated?await ee():await re();return s.emit("cart/initialized",e),s.emit("cart/data",e),i.initializing=!1,e};async function ee(){const e=i.cartId,t=await m();return t?(i.cartId=t.id,!e||t.id===e?t:await y(Z,{variables:{guestCartId:e,customerCartId:t.id}}).then(()=>m()).then(n=>{const r={oldCartItems:t.items,newCart:n};return s.emit("cart/merged",r),n}).catch(()=>(console.error("Could not merge carts"),t))):null}async function re(){if(N.getConfig().disableGuestCart===!0||!i.cartId)return null;try{return await m()}catch(e){return console.error(e),null}}const te=`
39
+ ${l}
40
+ `,c=async()=>{if(a.initializing)return null;a.initializing=!0,a.config||(a.config=await A());const t=a.authenticated?await S():await R();return e.emit("cart/initialized",t),e.emit("cart/data",t),a.initializing=!1,t};async function S(){const t=a.cartId,r=await _();return r?(a.cartId=r.id,!t||r.id===t?r:await s(E,{variables:{guestCartId:t,customerCartId:r.id}}).then(()=>_()).then(i=>{const n={oldCartItems:r.items,newCart:i};return e.emit("cart/merged",n),i}).catch(()=>(console.error("Could not merge carts"),r))):null}async function R(){if(h.getConfig().disableGuestCart===!0||!a.cartId)return null;try{return await _()}catch(t){return console.error(t),null}}const G=`
61
41
  query STORE_CONFIG_QUERY {
62
42
  storeConfig {
63
43
  minicart_display
@@ -78,4 +58,4 @@ query STORE_CONFIG_QUERY {
78
58
  configurable_thumbnail_source
79
59
  }
80
60
  }
81
- `,ne=async()=>y(te,{method:"GET",cache:"force-cache"}).then(({errors:e,data:t})=>e?d(e):j(t.storeConfig));export{h as C,re as a,m as b,N as c,f as d,ne as e,ee as g,w as i,R as t};
61
+ `,A=async()=>s(G,{method:"GET",cache:"force-cache"}).then(({errors:t,data:r})=>t?o(t):T(r.storeConfig));export{R as a,_ as b,h as c,c as d,A as e,S as g,d as i};
@@ -1,8 +1,8 @@
1
- import{s as m,f as i,h as p}from"./resetCart.js";import{C as T,t as _}from"./getStoreConfig.js";import{events as n}from"@dropins/tools/event-bus.js";import{p as I}from"./acdl.js";import{CART_FRAGMENT as u}from"../fragments.js";const C=`
1
+ import{s as m,f as i,h as p}from"./resetCart.js";import{C as _,a as I,t as T}from"./CartFragment.js";import{events as n}from"@dropins/tools/event-bus.js";import{p as u}from"./acdl.js";const C=`
2
2
  mutation UPDATE_PRODUCTS_FROM_CART_MUTATION(
3
3
  $cartId: String!,
4
4
  $cartItems: [CartItemUpdateInput!]!,
5
- ${T}
5
+ ${_}
6
6
  ) {
7
7
  updateCartItems(
8
8
  input: {
@@ -11,11 +11,10 @@ import{s as m,f as i,h as p}from"./resetCart.js";import{C as T,t as _}from"./get
11
11
  }
12
12
  ) {
13
13
  cart {
14
- ...CART_FRAGMENT
14
+ ...CartFragment
15
15
  }
16
16
 
17
17
  }
18
18
  }
19
-
20
- ${u}
21
- `,h=async e=>{const s=m.cartId;if(!s)throw Error("Cart ID is not set");return i(C,{variables:{cartId:s,cartItems:e.map(({uid:a,quantity:t})=>({cart_item_uid:a,quantity:t}))}}).then(({errors:a,data:t})=>{var c;const o=[...((c=t==null?void 0:t.addProductsToCart)==null?void 0:c.user_errors)??[],...a??[]];if(o.length>0)return p(o);const r=_(t.updateCartItems.cart);return n.emit("cart/updated",r),n.emit("cart/data",r),r&&I(r,e,m.locale??"en-US"),r})};export{h as u};
19
+ ${I}
20
+ `,U=async e=>{const s=m.cartId;if(!s)throw Error("Cart ID is not set");return i(C,{variables:{cartId:s,cartItems:e.map(({uid:a,quantity:t})=>({cart_item_uid:a,quantity:t}))}}).then(({errors:a,data:t})=>{var c;const o=[...((c=t==null?void 0:t.addProductsToCart)==null?void 0:c.user_errors)??[],...a??[]];if(o.length>0)return p(o);const r=T(t.updateCartItems.cart);return n.emit("cart/updated",r),n.emit("cart/data",r),r&&u(r,e,m.locale??"en-US"),r})};export{U as u};
@@ -12,6 +12,13 @@ export interface CartProps extends HTMLAttributes<HTMLDivElement> {
12
12
  OrderSummary?: SlotProps<DefaultSlotContext>;
13
13
  ProductList?: SlotProps;
14
14
  };
15
+ showDiscount?: boolean;
16
+ showSavings?: boolean;
17
+ quantityType?: 'stepper' | 'dropdown';
18
+ dropdownOptions?: {
19
+ value: string;
20
+ text: string;
21
+ }[];
15
22
  }
16
23
  export declare const Cart: Container<CartProps, CartModel | null>;
17
24
  export {};
@@ -1 +1 @@
1
- import{C as n,C as q}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";export{n as Cart,q as default};
1
+ import{C as k,C as n}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/CartFragment.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";export{k as Cart,n as default};
@@ -21,6 +21,13 @@ export interface CartSummaryListProps extends HTMLAttributes<HTMLDivElement> {
21
21
  enableRemoveItem?: boolean;
22
22
  enableUpdateItemQuantity?: boolean;
23
23
  onItemsErrorsChange?: (errors: Map<string, string>) => void;
24
+ showDiscount?: boolean;
25
+ showSavings?: boolean;
26
+ quantityType?: 'stepper' | 'dropdown';
27
+ dropdownOptions?: {
28
+ value: string;
29
+ text: string;
30
+ }[];
24
31
  }
25
32
  export type SwitchableAttributes = 'name' | 'image' | 'configurations' | 'warning' | 'alert' | 'sku' | 'price' | 'quantity' | 'total' | 'totalDiscount' | 'totalExcludingTax';
26
33
  export declare const CartSummaryList: Container<CartSummaryListProps, CartModel | null>;
@@ -1 +1 @@
1
- import{C as S,C as b}from"../chunks/CartSummaryList.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";/* empty css */import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/acdl.js";export{S as CartSummaryList,b as default};
1
+ import{C as L,C as S}from"../chunks/CartSummaryList.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";/* empty css */import"../chunks/EmptyCart.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/updateProductsFromCart.js";import"../chunks/CartFragment.js";import"../chunks/acdl.js";export{L as CartSummaryList,S as default};
@@ -10,6 +10,8 @@ export interface MiniCartProps extends HTMLAttributes<HTMLDivElement> {
10
10
  slots?: {
11
11
  ProductList?: SlotProps;
12
12
  };
13
+ showDiscount?: boolean;
14
+ showSavings?: boolean;
13
15
  }
14
16
  export declare const MiniCart: Container<MiniCartProps, CartModel | null>;
15
17
  //# sourceMappingURL=MiniCart.d.ts.map
@@ -1 +1 @@
1
- import{M as j,M as k}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";export{j as MiniCart,k as default};
1
+ import{M as h,M as j}from"../chunks/MiniCart.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"../chunks/persisted-data.js";import"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/acdl.js";import"../chunks/updateProductsFromCart.js";import"../chunks/CartFragment.js";import"../chunks/CartSummaryGrid.js";import"../chunks/EmptyCart.js";import"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"../chunks/getEstimatedTotals.js";export{h as MiniCart,j as default};
@@ -1 +1 @@
1
- import{O as S,O as b}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/getStoreConfig.js";import"../fragments.js";import"../chunks/acdl.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/i18n.js";export{S as OrderSummary,b as default};
1
+ import{O as y,O as S}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/CartFragment.js";import"../chunks/acdl.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/i18n.js";export{y as OrderSummary,S as default};
@@ -88,6 +88,8 @@ export interface Item {
88
88
  outOfStock?: boolean;
89
89
  notAvailableMessage?: string;
90
90
  stockLevel?: String;
91
+ discountPercentage?: number;
92
+ savingsAmount?: Price;
91
93
  }
92
94
  interface ItemError {
93
95
  id: string;
@@ -940,5 +940,65 @@ 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 simpleWithNoDiscount: {
944
+ prices: {
945
+ row_total: {
946
+ value: number;
947
+ currency: string;
948
+ };
949
+ original_row_total: {
950
+ value: number;
951
+ currency: string;
952
+ };
953
+ price: {
954
+ value: number;
955
+ currency: string;
956
+ };
957
+ total_item_discount: {
958
+ value: number;
959
+ currency: string;
960
+ };
961
+ price_including_tax: {
962
+ value: number;
963
+ currency: string;
964
+ };
965
+ row_total_including_tax: {
966
+ value: number;
967
+ };
968
+ };
969
+ product: {
970
+ price_range: {
971
+ maximum_price: {
972
+ regular_price: {
973
+ value: number;
974
+ currency: string;
975
+ };
976
+ final_price: {
977
+ value: number;
978
+ currency: string;
979
+ };
980
+ discount: {
981
+ amount_off: number;
982
+ percent_off: number;
983
+ };
984
+ };
985
+ };
986
+ name: string;
987
+ sku: string;
988
+ thumbnail: {
989
+ url: string;
990
+ label: string;
991
+ };
992
+ url_key: string;
993
+ url_suffix: string;
994
+ categories: {
995
+ url_path: string;
996
+ url_key: string;
997
+ }[];
998
+ };
999
+ uid: string;
1000
+ quantity: number;
1001
+ errors: null;
1002
+ };
1003
+ export { bundleOptions, bundleOptionsEmpty, giftCardPhysical, giftCardVirtual, simple, simpleCustomizable, configurable, configurableCustomizable, giftCard, downloadbleWithMultipleLinks, simpleLowInventory, complexInsufficientQuantity, complexInsufficientQuantityGeneralMessage, simpleWithNoDiscount, };
944
1004
  //# sourceMappingURL=productTypesData.d.ts.map
@@ -78,7 +78,9 @@ declare const _default: {
78
78
  "lowInventory": "Only {count} left!",
79
79
  "insufficientQuantity": "Only {inventory} of {count} in stock",
80
80
  "insufficientQuantityGeneral": "Not enough items for sale",
81
- "notAvailableMessage": "Requested qty. not available"
81
+ "notAvailableMessage": "Requested qty. not available",
82
+ "discountPercentage": "{discount}% off",
83
+ "savingsAmount": "Savings"
82
84
  },
83
85
  "EstimateShipping": {
84
86
  "label": "Shipping",
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-cart", "version": "0.7.0-alpha007", "@dropins/tools": "0.31.0-alpha007"}
1
+ {"name": "@dropins/storefront-cart", "version": "0.7.0-alpha012", "@dropins/tools": "0.32.0-alpha3"}
package/render.js CHANGED
@@ -1,2 +1,2 @@
1
1
  (function(i,r){try{if(typeof document<"u"){const a=document.createElement("style"),n=r.styleId;for(const t in r.attributes)a.setAttribute(t,r.attributes[t]);a.setAttribute("data-dropin",n),a.appendChild(document.createTextNode(i));const e=document.querySelector('style[data-dropin="sdk"]');if(e)e.after(a);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})(".cart-cart{container-type:inline-size;container-name:cart}.cart-cart__wrapper{display:grid;grid-template-rows:auto 1fr}.cart-cart__heading{display:grid;row-gap:var(--spacing-small);padding:var(--spacing-medium);padding-bottom:0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart__heading-divider{width:100%;margin:0}.cart-cart__content{display:grid;grid-template-columns:1fr;padding:0 var(--spacing-medium) var(--spacing-medium)}.cart-cart__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}.dropin-price-summary__shipping--zip,.dropin-price-summary__shipping--state{background-color:var(--color-neutral-50)}@container cart (width >= 1024px){.cart-cart__wrapper{grid-template-columns:repeat(var(--grid-3-columns),1fr);grid-column-gap:var(--grid-3-gutters);margin:0 var(--grid-3-margins)}.cart-cart__heading{padding:var(--spacing-small) 0 0 0}.cart-cart__content{padding:var(--spacing-medium) 0}.cart-cart__content .cart-cart-summary-list__heading{padding:0}.cart-cart__heading,.cart-cart__content{grid-column:1 / span 8}.cart-cart__order-summary{grid-row:1 / span 3;grid-column:9 / span 4;height:min-content}.cart-cart__heading--full-width,.cart-cart__content--empty,.cart-cart__content--full-width{grid-column:1 / span 12}}.cart-empty-cart{container-type:inline-size;container-name:cart}.cart-empty-cart__wrapper .dropin-card--secondary{display:grid;grid-auto-rows:min-content;justify-content:center;text-align:center}@container cart (width < 737px){.cart-empty-cart__wrapper .dropin-card{border:unset;border-style:hidden}}.cart-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xsmall);align-items:flex-end;color:var(--color-neutral-800)}.cart-estimate-shipping__label,.cart-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-estimate-shipping__price{text-align:right}a.cart-estimate-shippingLink{text-decoration:underline}.cart-estimate-shipping__label--bold,.cart-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-estimate-shipping--zip,.cart-estimate-shipping--state{background-color:var(--color-neutral-50)}.cart-estimate-shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small)}a.cart-estimate-shipping__link{text-decoration:underline}.cart-estimate-shipping--hide{display:none!important}.cart-estimate-shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-estimate-shipping--loading{opacity:.4;pointer-events:none}.cart-mini-cart{display:flex;flex-direction:column;height:100%;padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium);box-sizing:border-box}.cart-mini-cart__empty-cart{width:100%;max-width:800px;height:100%;display:flex;flex-direction:column;justify-content:center;align-self:center}.cart-mini-cart__heading{display:grid;row-gap:var(--spacing-xsmall);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing)}.cart-mini-cart__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 0 0}.cart-mini-cart__products{flex:1;overflow-y:auto;max-height:100%;padding-bottom:var(--spacing-medium)}.cart-mini-cart__products .cart-cart-summary-list__heading{padding:0}.cart-mini-cart__products .dropin-cart-item__configurations li{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cart-mini-cart__footer{display:grid;grid-auto-flow:row;gap:var(--spacing-small);padding-top:var(--spacing-small);row-gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall)}.cart-mini-cart__footer__estimated-total-excluding-taxes{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);display:grid;grid-template:max-content / 1fr auto;gap:var(--spacing-xsmall);color:var(--color-neutral-700)}.cart-mini-cart__footer__ctas{display:grid;grid-auto-flow:row;gap:var(--spacing-xsmall);padding-top:var(--spacing-small)}.cart-cart-summary-grid{container-type:inline-size;container-name:cart-summary-grid;max-width:inherit}.cart-cart-summary-grid__content{display:grid;flex-wrap:wrap;gap:var(--spacing-small);grid-template-columns:repeat(6,1fr);margin:auto}.cart-cart-summary-grid__item-container{aspect-ratio:auto 3/4;display:inline-block}.cart-cart-summary-grid__item-container img{height:auto;max-width:100%}.cart-cart-summary-grid__item-container a:focus{display:block}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}.cart-cart-summary-grid__empty-cart{align-self:center;justify-self:center;max-width:800px;width:100%}@container cart-summary-grid (width < 360px){.cart-cart-summary-grid__content{grid-template-columns:repeat(4,1fr);gap:var(--spacing-xsmall)}.cart-cart-summary-grid__content--empty{grid-template-columns:repeat(1,1fr)}}.cart-cart-summary-list{container-type:inline-size;container-name:cart-summary-list}.cart-cart-summary-list__heading{display:grid;row-gap:var(--spacing-xsmall);padding:var(--spacing-medium) 0 0 0;font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.cart-cart-summary-list__heading--full-width{width:100%}.cart-cart-summary-list__heading-divider{width:100%;margin:var(--spacing-xxsmall) 0 var(--spacing-medium) 0}.cart-cart-summary-list__content{display:grid;grid-template-columns:1fr;padding:0}.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-xsmall)) 0 var(--spacing-medium) 0}.cart-cart-summary-list__empty-cart{justify-self:center;align-self:center;width:100%;max-width:800px}@container cart-summary-list (width >= 768px){.cart-cart-summary-list__out-of-stock-message{margin:calc(-1 * var(--spacing-small)) 0 var(--spacing-xxbig) 0}}@container cart-summary-list (width >= 1024px){.cart-cart-summary-list__content,.cart-cart-summary-list__heading{grid-column:1 / span 8}.cart-cart-summary-list__heading--full-width,.cart-cart-summary-list__content--empty{grid-column:1 / span 12}.cart-cart-summary-list__content{padding:0}}.cart-order-summary{display:grid;position:relative;grid-auto-flow:row;padding:var(--spacing-medium)}.cart-order-summary__primary{background-color:var(--color-neutral-200)}.cart-order-summary__secondary{background-color:var(--color-neutral-50)}.cart-order-summary__content{display:grid;gap:var(--spacing-xsmall);margin-top:var(--spacing-small)}.cart-order-summary__heading{display:grid;font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);color:var(--color-neutral-800);gap:var(--spacing-small)}.cart-order-summary__label,.cart-order-summary__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.cart-order-summary__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.cart-order-summary__price{text-align:right}.cart-order-summary__taxes .dropin-divider:last-child{margin-bottom:0}.cart-order-summary__total{margin-top:var(--spacing-medium)}.cart-order-summary__label--bold,.cart-order-summary__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.cart-order-summary__divider-primary,.cart-order-summary__divider-secondary{width:100%;margin:0}.cart-order-summary__divider-secondary{margin:0}.cart-order-summary__taxEntry.cart-order-summary__entry{margin-top:0}.cart-order-summary__entry,.cart-order-summary__taxEntry{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.cart-order-summary__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);grid-column:span 2;color:var(--color-neutral-700)}.cart-order-summary__primaryAction{margin-top:var(--spacing-small);grid-template-columns:1fr}.cart-order-summary__shipping--edit{display:grid;grid-column:1 / span 2;gap:var(--spacing-small);padding-top:var(--spacing-small);padding-left:var(--spacing-small)}a.cart-order-summary__shippingLink{text-decoration:underline}.cart-order-summary__shipping--hide{display:none!important}.cart-order-summary__shipping--edit button{width:var(--spacing-huge);justify-self:end}.cart-order-summary__shipping--zip,.cart-order-summary__shipping--state{background-color:var(--color-neutral-50)}.cart-order-summary__taxes .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.cart-order-summary--loading{opacity:.4;pointer-events:none}.cart-order-summary__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}",{styleId:"Cart"});
2
- import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as d}from"@dropins/tools/lib.js";import{useState as u,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./fragments.js";const f={Cart:{heading:"Shopping Cart ({count})"},MiniCart:{heading:"Shopping Cart ({count})",subtotal:"Subtotal",subtotalExcludingTaxes:"Subtotal excluding taxes",cartLink:"View Cart",checkoutLink:"Checkout"},EmptyCart:{heading:"Your cart is empty",cta:"Start shopping"},PriceSummary:{taxToBeDetermined:"TBD",checkout:"Checkout",orderSummary:"Order Summary",subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",label:"Total",withoutTax:"Total excluding taxes"},estimatedShippingForm:{country:{placeholder:"Country"},state:{placeholder:"State"},zip:{placeholder:"Zip Code"},apply:{label:"Apply"}},freeShipping:"Free"},CartItem:{discountedPrice:"Discounted Price",download:"file",message:"Note",recipient:"To",regularPrice:"Regular Price",sender:"From",file:"{count} file",files:"{count} files",lowInventory:"Only {count} left!",insufficientQuantity:"Only {inventory} of {count} in stock",insufficientQuantityGeneral:"Not enough items for sale",notAvailableMessage:"Requested qty. not available"},EstimateShipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},OutOfStockMessage:{heading:"Your cart contains items with limited stock",message:"Please adjust quantities to continue",alert:"Out of stock",action:"Remove all out of stock items from cart"}},x={Cart:f},S={default:x},y=({children:o})=>{var i;const[t,s]=u(),r=(i=h.getConfig())==null?void 0:i.langDefinitions;p(()=>{const e=g.on("locale",a=>{a!==t&&s(a)},{eager:!0});return()=>{e==null||e.off()}},[t]);const l=c(S,r??{});return n(m,{lang:t,langDefinitions:l,children:o})},v=new d(n(y,{}));export{v as render};
2
+ import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as c,Render as u}from"@dropins/tools/lib.js";import{useState as d,useEffect as p}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as g}from"@dropins/tools/event-bus.js";import"./chunks/resetCart.js";import{c as h}from"./chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/persisted-data.js";import"./chunks/CartFragment.js";const f={Cart:{heading:"Shopping Cart ({count})"},MiniCart:{heading:"Shopping Cart ({count})",subtotal:"Subtotal",subtotalExcludingTaxes:"Subtotal excluding taxes",cartLink:"View Cart",checkoutLink:"Checkout"},EmptyCart:{heading:"Your cart is empty",cta:"Start shopping"},PriceSummary:{taxToBeDetermined:"TBD",checkout:"Checkout",orderSummary:"Order Summary",subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",label:"Total",withoutTax:"Total excluding taxes"},estimatedShippingForm:{country:{placeholder:"Country"},state:{placeholder:"State"},zip:{placeholder:"Zip Code"},apply:{label:"Apply"}},freeShipping:"Free"},CartItem:{discountedPrice:"Discounted Price",download:"file",message:"Note",recipient:"To",regularPrice:"Regular Price",sender:"From",file:"{count} file",files:"{count} files",lowInventory:"Only {count} left!",insufficientQuantity:"Only {inventory} of {count} in stock",insufficientQuantityGeneral:"Not enough items for sale",notAvailableMessage:"Requested qty. not available",discountPercentage:"{discount}% off",savingsAmount:"Savings"},EstimateShipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},OutOfStockMessage:{heading:"Your cart contains items with limited stock",message:"Please adjust quantities to continue",alert:"Out of stock",action:"Remove all out of stock items from cart"}},x={Cart:f},S={default:x},y=({children:o})=>{var i;const[t,s]=d(),r=(i=h.getConfig())==null?void 0:i.langDefinitions;p(()=>{const e=g.on("locale",a=>{a!==t&&s(a)},{eager:!0});return()=>{e==null||e.off()}},[t]);const l=c(S,r??{});return n(m,{lang:t,langDefinitions:l,children:o})},L=new u(n(y,{}));export{L as render};
@@ -1,3 +0,0 @@
1
- export { CART_FRAGMENT } from './graphql/CartFragment';
2
- export { CART_ITEM_FRAGMENT } from './graphql/CartItemFragment';
3
- //# sourceMappingURL=fragments.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const CART_ITEM_FRAGMENT: string;
2
- //# sourceMappingURL=CartItemFragment.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const CUSTOMER_ACCOUNT_FRAGMENT = "\nfragment CUSTOMER_FRAGMENT on Customer {\n addresses {\n default_shipping\n country_id\n postcode\n region {\n region\n region_code\n region_id\n }\n }\n}";
2
- //# sourceMappingURL=CustomerAccountFragment.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const CUSTOMIZABLE_OPTIONS_FRAGMENT = "\n fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {\n type\n customizable_option_uid\n label\n is_required\n values {\n label\n value\n price{\n type\n units\n value\n }\n }\n }\n";
2
- //# sourceMappingURL=CustomizableOptionsFragment.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const PRICE_RANGE_FRAGMENT = "\n fragment PRICE_RANGE_FRAGMENT on PriceRange {\n minimum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n maximum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n }\n";
2
- //# sourceMappingURL=PriceRangeFragment.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const CART_ITEMS_PAGINATION_ARGUMENTS = "\n $pageSize: Int! = 100,\n $currentPage: Int! = 1,\n $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}\n";
2
- //# sourceMappingURL=arguments.d.ts.map
package/fragments.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './api/fragments'
package/fragments.js DELETED
@@ -1,239 +0,0 @@
1
- const e=`
2
- fragment PRICE_RANGE_FRAGMENT on PriceRange {
3
- minimum_price {
4
- regular_price {
5
- value
6
- currency
7
- }
8
- final_price {
9
- value
10
- currency
11
- }
12
- discount {
13
- percent_off
14
- amount_off
15
- }
16
- }
17
- maximum_price {
18
- regular_price {
19
- value
20
- currency
21
- }
22
- final_price {
23
- value
24
- currency
25
- }
26
- discount {
27
- percent_off
28
- amount_off
29
- }
30
- }
31
- }
32
- `,a=`
33
- fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {
34
- type
35
- customizable_option_uid
36
- label
37
- is_required
38
- values {
39
- label
40
- value
41
- price{
42
- type
43
- units
44
- value
45
- }
46
- }
47
- }
48
- `,t=`
49
- fragment CART_ITEM_FRAGMENT on CartItemInterface {
50
- __typename
51
- uid
52
- quantity
53
- is_available
54
- not_available_message
55
- errors {
56
- code
57
- message
58
- }
59
-
60
- prices {
61
- price {
62
- value
63
- currency
64
- }
65
- total_item_discount {
66
- value
67
- currency
68
- }
69
- row_total {
70
- value
71
- currency
72
- }
73
- row_total_including_tax {
74
- value
75
- currency
76
- }
77
- price_including_tax {
78
- value
79
- currency
80
- }
81
- fixed_product_taxes {
82
- amount {
83
- value
84
- currency
85
- }
86
- label
87
- }
88
- original_row_total{
89
- value
90
- currency
91
- }
92
- }
93
-
94
- product {
95
- name
96
- sku
97
- thumbnail {
98
- url
99
- label
100
- }
101
- url_key
102
- url_suffix
103
- categories {
104
- url_path
105
- url_key
106
- }
107
- only_x_left_in_stock
108
- stock_status
109
-
110
- price_range {
111
- ...PRICE_RANGE_FRAGMENT
112
- }
113
- }
114
- ...on SimpleCartItem {
115
- customizable_options {
116
- ...CUSTOMIZABLE_OPTIONS_FRAGMENT
117
- }
118
- }
119
- ... on ConfigurableCartItem {
120
- configurable_options {
121
- configurable_product_option_uid
122
- option_label
123
- value_label
124
- }
125
- configured_variant {
126
- uid
127
- sku
128
- only_x_left_in_stock
129
- stock_status
130
- thumbnail {
131
- label
132
- url
133
- }
134
- price_range {
135
- ...PRICE_RANGE_FRAGMENT
136
- }
137
- }
138
- customizable_options {
139
- ...CUSTOMIZABLE_OPTIONS_FRAGMENT
140
- }
141
- }
142
- ... on DownloadableCartItem {
143
- links {
144
- sort_order
145
- title
146
- }
147
- customizable_options {
148
- ...CUSTOMIZABLE_OPTIONS_FRAGMENT
149
- }
150
- }
151
- ... on BundleCartItem {
152
- bundle_options {
153
- uid
154
- label
155
- values {
156
- uid
157
- label
158
- }
159
- }
160
- }
161
- ... on GiftCardCartItem {
162
- message
163
- recipient_email
164
- recipient_name
165
- sender_email
166
- sender_name
167
- amount{
168
- currency
169
- value
170
- }
171
- is_available
172
- }
173
- }
174
-
175
- ${e}
176
- ${a}
177
- `,r=`
178
- fragment CART_FRAGMENT on Cart {
179
- id
180
- total_quantity
181
- is_virtual
182
- prices {
183
- subtotal_with_discount_excluding_tax {
184
- currency
185
- value
186
- }
187
- subtotal_including_tax {
188
- currency
189
- value
190
- }
191
- subtotal_excluding_tax {
192
- currency
193
- value
194
- }
195
- grand_total {
196
- currency
197
- value
198
- }
199
- grand_total_excluding_tax {
200
- currency
201
- value
202
- }
203
- applied_taxes {
204
- label
205
- amount {
206
- value
207
- currency
208
- }
209
- }
210
- discounts {
211
- amount {
212
- value
213
- currency
214
- }
215
- label
216
- }
217
- }
218
- itemsV2 (
219
- pageSize:$pageSize,
220
- currentPage:$currentPage,
221
- sort: $itemsSortInput
222
- ) {
223
- items {
224
- ...CART_ITEM_FRAGMENT
225
- }
226
- }
227
- shipping_addresses {
228
- country {
229
- code
230
- }
231
- region {
232
- code
233
- }
234
- postcode
235
- }
236
- }
237
-
238
- ${t}
239
- `;export{r as CART_FRAGMENT,t as CART_ITEM_FRAGMENT};